Subversion Repositories

?revision_form?Rev ?revision_input??revision_submit??revision_endform?

Blame | Last modification | View Log | RSS feed

Index: prayer-1.0.18/prayer/os.h
===================================================================
--- prayer-1.0.18.orig/prayer/os.h      2007-03-10 19:56:40.357114747 +0100
+++ prayer-1.0.18/prayer/os.h   2007-03-10 19:57:56.266959171 +0100
@@ -44,6 +44,8 @@ BOOL os_signal_alarm_clear(void);
 
 BOOL os_signal_init();
 
+BOOL os_signal_hup_term_init(void (*hup_fn) (), void (*term_fn) ());
+
 BOOL os_lock_exclusive(int fd);
 
 BOOL os_lock_shared(int fd);
Index: prayer-1.0.18/prayer/session_server.c
===================================================================
--- prayer-1.0.18.orig/prayer/session_server.c  2007-03-10 19:56:40.647152355 +0100
+++ prayer-1.0.18/prayer/session_server.c       2007-03-10 19:57:56.326966954 +0100
@@ -355,6 +355,7 @@ BOOL session_server(struct config *confi
     fd_set readfds;
     pid_t child;
     unsigned long timeout = 0L;
+    BOOL sighup_seen = NIL;
 
     if (config->direct_enable) {
         ssl_portlist
@@ -420,6 +421,18 @@ BOOL session_server(struct config *confi
             } else {
                 rc = select(maxfd + 1, &readfds, NIL, NIL, NIL);
             }
+           if (sighup_seen) {
+               log_misc("SIGHUP received - reexec daemon");
+               close(sockfd);
+               if (config->direct_enable) {
+                   /* Find some way to pass this information along
+                      to the new invocation somehow later. */
+                   portlist_close_all(ssl_portlist);
+                   portlist_close_all(plain_portlist);
+               }
+               log_misc_free();
+               return (T);
+           }
         }
         while ((rc < 0) && (errno == EINTR));
 
Index: prayer-1.0.18/prayer/log.c
===================================================================
--- prayer-1.0.18.orig/prayer/log.c     2007-03-10 19:58:03.667919109 +0100
+++ prayer-1.0.18/prayer/log.c  2007-03-10 19:58:11.688959503 +0100
@@ -502,6 +502,13 @@ BOOL log_misc_init(struct config *config
     return (log_open(log_misc_ptr, log_name));
 }
 
+void log_misc_free()
+{
+    if ((log_misc_ptr == NIL) || (log_misc_ptr->fd < 0))
+        return;
+    log_free(log_misc_ptr);
+}
+
 /* log_misc_ping() *******************************************************
  *
  * Reopen misc log file if required
Index: prayer-1.0.18/prayer/log.h
===================================================================
--- prayer-1.0.18.orig/prayer/log.h     2007-03-10 19:58:04.067970999 +0100
+++ prayer-1.0.18/prayer/log.h  2007-03-10 19:58:11.648954314 +0100
@@ -45,6 +45,8 @@ void log_record_peer_pid(struct log *log
 BOOL
 log_misc_init(struct config *config, char *progname, char *misc_log_name);
 
+void log_misc_free();
+
 BOOL log_misc_ping();
 
 void log_misc(char *fmt, ...);