Subversion Repositories

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

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 magnus 1
Index: prayer-1.0.18/prayer/os.h
2
===================================================================
3
--- prayer-1.0.18.orig/prayer/os.h      2007-03-10 19:56:40.357114747 +0100
4
+++ prayer-1.0.18/prayer/os.h   2007-03-10 19:57:56.266959171 +0100
5
@@ -44,6 +44,8 @@ BOOL os_signal_alarm_clear(void);
6
 
7
 BOOL os_signal_init();
8
 
9
+BOOL os_signal_hup_term_init(void (*hup_fn) (), void (*term_fn) ());
10
+
11
 BOOL os_lock_exclusive(int fd);
12
 
13
 BOOL os_lock_shared(int fd);
14
Index: prayer-1.0.18/prayer/session_server.c
15
===================================================================
16
--- prayer-1.0.18.orig/prayer/session_server.c  2007-03-10 19:56:40.647152355 +0100
17
+++ prayer-1.0.18/prayer/session_server.c       2007-03-10 19:57:56.326966954 +0100
18
@@ -355,6 +355,7 @@ BOOL session_server(struct config *confi
19
     fd_set readfds;
20
     pid_t child;
21
     unsigned long timeout = 0L;
22
+    BOOL sighup_seen = NIL;
23
 
24
     if (config->direct_enable) {
25
         ssl_portlist
26
@@ -420,6 +421,18 @@ BOOL session_server(struct config *confi
27
             } else {
28
                 rc = select(maxfd + 1, &readfds, NIL, NIL, NIL);
29
             }
30
+           if (sighup_seen) {
31
+               log_misc("SIGHUP received - reexec daemon");
32
+               close(sockfd);
33
+               if (config->direct_enable) {
34
+                   /* Find some way to pass this information along
35
+                      to the new invocation somehow later. */
36
+                   portlist_close_all(ssl_portlist);
37
+                   portlist_close_all(plain_portlist);
38
+               }
39
+               log_misc_free();
40
+               return (T);
41
+           }
42
         }
43
         while ((rc < 0) && (errno == EINTR));
44
 
45
Index: prayer-1.0.18/prayer/log.c
46
===================================================================
47
--- prayer-1.0.18.orig/prayer/log.c     2007-03-10 19:58:03.667919109 +0100
48
+++ prayer-1.0.18/prayer/log.c  2007-03-10 19:58:11.688959503 +0100
49
@@ -502,6 +502,13 @@ BOOL log_misc_init(struct config *config
50
     return (log_open(log_misc_ptr, log_name));
51
 }
52
 
53
+void log_misc_free()
54
+{
55
+    if ((log_misc_ptr == NIL) || (log_misc_ptr->fd < 0))
56
+        return;
57
+    log_free(log_misc_ptr);
58
+}
59
+
60
 /* log_misc_ping() *******************************************************
61
  *
62
  * Reopen misc log file if required
63
Index: prayer-1.0.18/prayer/log.h
64
===================================================================
65
--- prayer-1.0.18.orig/prayer/log.h     2007-03-10 19:58:04.067970999 +0100
66
+++ prayer-1.0.18/prayer/log.h  2007-03-10 19:58:11.648954314 +0100
67
@@ -45,6 +45,8 @@ void log_record_peer_pid(struct log *log
68
 BOOL
69
 log_misc_init(struct config *config, char *progname, char *misc_log_name);
70
 
71
+void log_misc_free();
72
+
73
 BOOL log_misc_ping();
74
 
75
 void log_misc(char *fmt, ...);