$Log$
+Revision 400.89 2003/02/07 04:44:17 ajc
+* Replaced sleep() with a function that sleeps using select() in order to
+ avoid potential issues with SIGALRM. Possible fix for weird behavior
+ when running on a Macintosh.
+
Revision 400.88 2003/01/29 22:32:07 ajc
* Shuffled some code and comments around; minor cleanup
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
-
/* Remove sessions flagged for kill */
if (sptr->killthis) {
- lprintf(3, "Destroying session\n");
+ lprintf(3, "Destroying session %d\n",
+ sptr->wc_session);
/* remove session from linked list */
if (sptr == SessionList) {
void housekeeping_loop(void)
{
while (1) {
- sleep(HOUSEKEEPING);
+ sleeeeeeeeeep(HOUSEKEEPING);
do_housekeeping();
}
}
* Generate a unique WebCit session ID (which is not the same thing as the
* Citadel session ID).
*
- * FIX ... ensure that session number is truly unique
+ * FIXME ... ensure that session number is truly unique
*
*/
int GenerateSessionID(void)
}
+
+/*
+ * Replacement for sleep() that uses select() in order to avoid SIGALRM
+ */
+void sleeeeeeeeeep(int seconds)
+{
+ struct timeval tv;
+
+ tv.tv_sec = seconds;
+ tv.tv_usec = 0;
+ select(0, NULL, NULL, NULL, &tv);
+}
+
extern char *months[];
extern char *days[];
void read_server_binary(char *buffer, size_t total_len);
+void sleeeeeeeeeep(int);
struct tm *tim;
gettimeofday(&tv, NULL);
- tim = localtime(&(tv.tv_sec));
+ tim = localtime((time_t *)&(tv.tv_sec));
if (WC && WC->wc_session) {
fprintf(stderr,
tim->tm_year + 1900, tim->tm_mon + 1,
tim->tm_mday, tim->tm_hour, tim->tm_min,
tim->tm_sec, (long)tv.tv_usec / 1000,
- pthread_self(), WC->wc_session, buf);
+ (long)pthread_self(),
+ WC->wc_session, buf);
} else {
fprintf(stderr,
"%04d/%02d/%02d %2d:%02d:%02d.%03ld [%ld] %s",
tim->tm_year + 1900, tim->tm_mon + 1,
tim->tm_mday, tim->tm_hour, tim->tm_min,
tim->tm_sec, (long)tv.tv_usec / 1000,
- pthread_self(), buf);
+ (long)pthread_self(),
+ buf);
}
fflush(stderr);
}