-/*----------------------------------------------------------
- | printHelp
- | print information from long option array
- +--------------------------------------------------------- */
-
- static void printHelp(char *name) {
- int ind;
- char command[20];
-
- fprintf (stderr,"%s:\nallowed options\n", name);
- for (ind=0; cliOptions [ind].name != NULL;ind++)
- {
- // display options
- if (cliOptions [ind].has_arg == 0 )
- {
- fprintf (stderr," --%-15s %s\n", cliOptions [ind].name, cliOptions[ind].help);
- } else {
- sprintf(command,"%s=xxxx", cliOptions [ind].name);
- fprintf (stderr," --%-15s %s\n", command, cliOptions[ind].help);
- }
- }
- fprintf (stderr,"Example:\n %s\\\n --verbose --port=1234 --token='azerty' --ldpaths=build/plugins:/usr/lib64/agl/plugins\n", name);
-} // end printHelp
-
-/*----------------------------------------------------------
- | closeSession
- | try to close everything before leaving
- +--------------------------------------------------------- */
-static void closeSession (int status, void *data) {
-// AFB_session *session = data;
-}
-
-/*----------------------------------------------------------
- | timeout signalQuit
- |
- +--------------------------------------------------------- */
-void signalQuit (int signum) {
-
- sigset_t sigset;
-
- // unlock timeout signal to allow a new signal to come
- sigemptyset (&sigset);
- sigaddset (&sigset, SIGABRT);
- sigprocmask (SIG_UNBLOCK, &sigset, 0);
-
- fprintf (stderr, "ERR: Received signal quit\n");
- syslog (LOG_ERR, "Daemon got kill3 & quit [please report bug]");
- exit(1);
-}
-
-
-/*----------------------------------------------------------
- | listenLoop
- | Main listening HTTP loop
- +--------------------------------------------------------- */
-static void listenLoop (AFB_session *session) {
- AFB_error err;
-
- // ------ Start httpd server
-
- err = httpdStart (session);
- if (err != AFB_SUCCESS) return;
-
- if (session->readyfd != 0) {
- static const char readystr[] = "READY=1";
- write(session->readyfd, readystr, sizeof(readystr) - 1);
- close(session->readyfd);
- }
-
- // infinite loop
- httpdLoop(session);
-
- fprintf (stderr, "hoops returned from infinite loop [report bug]\n");
-}
-