(retval >= 0))
retval = client_read_sslbuffer(Buf, timeout);
if (retval >= 0) {
- StrBufAppendBuf(Target, Buf, 0); /// todo: Buf > bytes?
+ StrBufAppendBuf(Target, Buf, 0); /* todo: Buf > bytes? */
#ifdef HTTP_TRACING
write(2, "\033[32m", 5);
write(2, buf, bytes);
}
#endif
- if (StrLength(Buf) > 0) {//// todo: what if Buf > bytes?
+ if (StrLength(Buf) > 0) {/*/// todo: what if Buf > bytes?*/
StrBufAppendBuf(Target, Buf, 0);
}
retval = StrBufReadBLOB(Target,
}
-/*
- * Get a LF-terminated line of text from the client.
- * (This is implemented in terms of client_read() and could be
- * justifiably moved out of sysdep.c)
- *
- * sock socket fd to get client line from
- * buf buffer to write read data to
- * bufsiz how many bytes to read
- *
- * returns the number of bytes read
- */
-/////int client_getln(int *sock, char *buf, int bufsiz)
-/////{
-///// int i, retval;
-/////
-///// /* Read one character at a time.*/
-///// for (i = 0; *sock > 0; i++) {
-///// retval = client_read(sock, &buf[i], 1);
-///// if (retval < 0)
-///// return retval;
-///// if (retval != 1 || buf[i] == '\n' || i == (bufsiz-1))
-///// break;
-///// if ( (!isspace(buf[i])) && (!isprint(buf[i])) ) {
-///// /* Non printable character recieved from client */
-///// return(-1);
-///// }
-///// }
-/////
-///// /* If we got a long line, discard characters until the newline. */
-///// if (i == (bufsiz-1))
-///// while (buf[i] != '\n' && retval == 1)
-///// retval = client_read(sock, &buf[i], 1);
-/////
-///// /*
-///// * Strip any trailing non-printable characters.
-///// */
-///// buf[i] = 0;
-///// while ((i > 0) && (!isprint(buf[i - 1]))) {
-///// buf[--i] = 0;
-///// }
-///// return (retval);
-/////}
/*
* Shut us down the regular way.
*/
pid_t current_child;
void graceful_shutdown(int signum) {
-// kill(current_child, signum);
char wd[SIZ];
FILE *FD;
int fd;
exit(errno);
}
- else if (current_child == 0) { // child process
-// signal(SIGTERM, graceful_shutdown);
+ else if (current_child == 0) { /* child process */
signal(SIGHUP, graceful_shutdown);
return; /* continue starting webcit. */
}
-
- else { // watcher process
-// signal(SIGTERM, SIG_IGN);
-// signal(SIGHUP, SIG_IGN);
+ else { /* watcher process */
if (pid_file) {
fp = fopen(pid_file, "w");
if (fp != NULL) {
pthread_attr_destroy(&attr);
}
-//#define DBG_PRINNT_HOOKS_AT_START
+/* #define DBG_PRINNT_HOOKS_AT_START */
#ifdef DBG_PRINNT_HOOKS_AT_START
const char foobuf[32];
const char *nix(void *vptr) {snprintf(foobuf, 32, "%0x", (long) vptr); return foobuf;}
start_daemon(pidfile);
}
else {
-/// signal(SIGTERM, graceful_shutdown);
signal(SIGHUP, graceful_shutdown);
}
if (msock > 0) ret = select(msock+1, &tempset, NULL, NULL, &tv);
end_critical_section(S_SELECT);
if ((ret < 0) && (errno != EINTR) && (errno != EAGAIN))
- {// EINTR and EAGAIN are thrown but not of interest.
+ {/* EINTR and EAGAIN are thrown but not of interest. */
lprintf(2, "accept() failed:%d %s\n",
errno, strerror(errno));
}
else if ((ret > 0) && (msock > 0) && FD_ISSET(msock, &tempset))
- {// Successfully selected, and still not shutting down? Accept!
+ {/* Successfully selected, and still not shutting down? Accept! */
ssock = accept(msock, NULL, 0);
}
} while ((msock > 0) && (ssock < 0) && (time_to_die == 0));
if ((msock == -1)||(time_to_die))
- {// ok, we're going down.
+ {/* ok, we're going down. */
int shutdown = 0;
/* the first to come here will have to do the cleanup.
}
end_critical_section(S_SHUTDOWN);
if (shutdown == 1)
- {// we're the one to cleanup the mess.
+ {/* we're the one to cleanup the mess. */
lprintf(2, "I'm master shutdown: tagging sessions to be killed.\n");
shutdown_sessions();
lprintf(2, "master shutdown: waiting for others\n");
- sleeeeeeeeeep(1); // wait so some others might finish...
+ sleeeeeeeeeep(1); /* wait so some others might finish... */
lprintf(2, "master shutdown: cleaning up sessions\n");
do_housekeeping();
lprintf(2, "master shutdown: cleaning up libical\n");
if (ssock > 0) close (ssock);
lprintf(2, "inbetween.");
pthread_exit(NULL);
- } else { // Got it? do some real work!
+ } else { /* Got it? do some real work! */
/* Set the SO_REUSEADDR socket option */
i = 1;
setsockopt(ssock, SOL_SOCKET, SO_REUSEADDR,