]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
define ALARM_UPDATES_TIME to use alarm(3). otherwise, update clock before each select()
authorwessels <>
Tue, 28 Oct 1997 06:30:20 +0000 (06:30 +0000)
committerwessels <>
Tue, 28 Oct 1997 06:30:20 +0000 (06:30 +0000)
src/Makefile.in
src/comm.cc
src/main.cc

index aeeed87dc2d704a7c13b0196cd3114f202d834df..418187a7a43ee47fcbaf86451fbf255e7b137dc8 100644 (file)
@@ -1,7 +1,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.86 1997/08/25 03:51:46 wessels Exp $
+#  $Id: Makefile.in,v 1.87 1997/10/27 23:30:20 wessels Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -15,11 +15,13 @@ KILL_PARENT_OPT     = # -DKILL_PARENT_OPT
 # do NOT define both USE_SPLAY_TREE and USE_BIN_TREE at the same time!
 USE_SPLAY_TREE  = # -DUSE_SPLAY_TREE
 USE_BIN_TREE    = # -DUSE_BIN_TREE
+ALARM_UPDATES_TIME = # -DALARM_UPDATES_TIME=1
 
 DEFINES         = $(HOST_OPT) $(AUTH_OPT) $(LOG_HDRS_OPT) \
                   $(ICMP_OPT) $(DELAY_HACK) $(USERAGENT_OPT) \
-                  $(KILL_PARENT_OPT) $(USE_POLL_OPT) \
-                  $(USE_SPLAY_TREE) $(USE_BIN_TREE)
+                  $(KILL_PARENT_OPT) $(USE_POLL_OPT) \ 
+                  $(USE_SPLAY_TREE) $(USE_BIN_TREE) \
+                 $(ALARM_UPDATES_TIME)
 
 prefix         = @prefix@
 exec_prefix    = @exec_prefix@
index 8c983158282db952aad7a5e44769f338fac1a536..2ba04c1eb61c62ab4c8caab7bf13b5c13095da5b 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm.cc,v 1.198 1997/10/27 21:58:48 wessels Exp $
+ * $Id: comm.cc,v 1.199 1997/10/27 23:30:22 wessels Exp $
  *
  * DEBUG: section 5     Socket Functions
  * AUTHOR: Harvest Derived
@@ -824,11 +824,11 @@ comm_poll(time_t sec)
     int poll_time;
     static int incoming_counter = 0;
     time_t timeout;
-    /* assume all process are very fast (less than 1 second). Call
-     * time() only once */
-    /* use only 1 second granularity */
     timeout = squid_curtime + sec;
     do {
+#if !ALARM_UPDATES_TIME
+       getCurrentTime();
+#endif
        if (shutdown_pending || reconfigure_pending) {
            serverConnectionsClose();
            dnsShutdownServers();
@@ -974,6 +974,9 @@ comm_select(time_t sec)
     timeout = squid_curtime + sec;
 
     do {
+#if !ALARM_UPDATES_TIME
+       getCurrentTime();
+#endif
        FD_ZERO(&readfds);
        FD_ZERO(&writefds);
        if (shutdown_pending || reconfigure_pending) {
index d452d62345f67978760fd35114d45f40173d0703..c448f1943eb214f1422aae3637002feeeb1cd1d2 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: main.cc,v 1.179 1997/10/26 02:35:35 wessels Exp $
+ * $Id: main.cc,v 1.180 1997/10/27 23:30:24 wessels Exp $
  *
  * DEBUG: section 1     Startup and Main Loop
  * AUTHOR: Harvest Derived
@@ -117,9 +117,11 @@ static int icpPortNumOverride = 1; /* Want to detect "-u 0" */
 static int malloc_debug_level = 0;
 #endif
 
-static void rotate_logs(int);
-static void reconfigure(int);
-static void time_tick(int);
+static SIGHDLR rotate_logs;
+static SIGHDLR reconfigure;
+#if ALARM_UPDATES_TIME
+static SIGHDLR time_tick;
+#endif
 static void mainInitialize(void);
 static void mainReconfigure(void);
 static void usage(void);
@@ -259,6 +261,7 @@ rotate_logs(int sig)
 #endif
 }
 
+#if ALARM_UPDATES_TIME
 static void
 time_tick(int sig)
 {
@@ -268,7 +271,7 @@ time_tick(int sig)
     signal(sig, time_tick);
 #endif
 }
-
+#endif
 
 static void
 reconfigure(int sig)
@@ -553,8 +556,10 @@ mainInitialize(void)
     squid_signal(SIGHUP, reconfigure, SA_RESTART);
     squid_signal(SIGTERM, shut_down, SA_NODEFER | SA_RESETHAND | SA_RESTART);
     squid_signal(SIGINT, shut_down, SA_NODEFER | SA_RESETHAND | SA_RESTART);
+#if ALARM_UPDATES_TIME
     squid_signal(SIGALRM, time_tick, SA_RESTART);
     alarm(1);
+#endif
     debug(1, 0) ("Ready to serve requests.\n");
 
     if (!configured_once) {