From 5ce523b7e5896c6f5be6ef461d11a477f1a0c679 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Fri, 29 Sep 2000 07:11:05 +0000 Subject: [PATCH] Fixed timeout handling after cras messed it up. --- lib/silcutil/silcschedule.c | 38 ++++++++----------------------------- 1 file changed, 8 insertions(+), 30 deletions(-) diff --git a/lib/silcutil/silcschedule.c b/lib/silcutil/silcschedule.c index b8b02757..1d081426 100644 --- a/lib/silcutil/silcschedule.c +++ b/lib/silcutil/silcschedule.c @@ -17,29 +17,7 @@ GNU General Public License for more details. */ -/* - * $Id$ - * $Log$ - * Revision 1.2 2000/09/28 08:50:31 priikone - * Added silc_schedule_one function to run the scheduler only ones. - * Patch by cras. - * - * Revision 1.1 2000/09/13 17:45:16 priikone - * Splitted SILC core library. Core library includes now only - * SILC protocol specific stuff. New utility library includes the - * old stuff from core library that is more generic purpose stuff. - * - * Revision 1.3 2000/07/18 06:51:58 priikone - * Debug version bug fixes. - * - * Revision 1.2 2000/07/05 06:06:35 priikone - * Global cosmetic change. - * - * Revision 1.1.1.1 2000/06/27 11:36:55 priikone - * Imported from internal CVS/Added Log headers. - * - * - */ +/* $Id$ */ #include "silcincludes.h" @@ -484,18 +462,18 @@ int silc_schedule_one(int timeout_usecs) schedule.timeout->tv_usec)); } + if (timeout_usecs >= 0) { + timeout.tv_sec = 0; + timeout.tv_usec = timeout_usecs; + schedule.timeout = &timeout; + } + /* This is the main select(). The program blocks here until some of the selected file descriptors change status or the selected timeout expires. */ SILC_LOG_DEBUG(("Select")); - if (timeout_usecs < 0) - memcpy(&timeout, schedule.timeout, sizeof(timeout)); - else { - timeout.tv_sec = 0; - timeout.tv_usec = timeout_usecs; - } switch (select(schedule.max_fd + 1, &schedule.in, - &schedule.out, 0, &timeout)) { + &schedule.out, 0, schedule.timeout)) { case -1: /* Error */ SILC_LOG_ERROR(("Error in select(): %s", strerror(errno))); -- 2.43.0