[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] Backport sigint/info crash fix



Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv13530/src/or

Modified Files:
      Tag: tor-0_1_0-patches
	connection.c control.c or.h 
Log Message:
Backport sigint/info crash fix

Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/connection.c,v
retrieving revision 1.373.2.1
retrieving revision 1.373.2.2
diff -u -d -r1.373.2.1 -r1.373.2.2
--- connection.c	9 Jun 2005 09:16:12 -0000	1.373.2.1
+++ connection.c	7 Aug 2005 19:40:17 -0000	1.373.2.2
@@ -232,6 +232,10 @@
     if (conn->state == OR_CONN_STATE_OPEN)
       directory_set_dirty();
   }
+  if (conn->type == CONN_TYPE_CONTROL) {
+    conn->event_mask = 0;
+    control_update_global_event_mask();
+  }
   connection_unregister(conn);
   _connection_free(conn);
 }
@@ -248,6 +252,12 @@
   connection_t **carray;
 
   get_connection_array(&carray,&n);
+
+  for (i=0;i<n;i++)
+    if (carray[i]->type == CONN_TYPE_CONTROL)
+      carray[i]->event_mask = 0;
+  control_update_global_event_mask();
+
   for (i=0;i<n;i++)
     _connection_free(carray[i]);
 }

Index: control.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/control.c,v
retrieving revision 1.83.2.2
retrieving revision 1.83.2.3
diff -u -d -r1.83.2.2 -r1.83.2.3
--- control.c	21 Jun 2005 21:52:17 -0000	1.83.2.2
+++ control.c	7 Aug 2005 19:40:17 -0000	1.83.2.3
@@ -127,7 +127,6 @@
 static int authentication_cookie_is_set = 0;
 static char authentication_cookie[AUTHENTICATION_COOKIE_LEN];
 
-static void update_global_event_mask(void);
 static void send_control_message(connection_t *conn, uint16_t type,
                                  uint32_t len, const char *body);
 static void send_control_done(connection_t *conn);
@@ -200,7 +199,8 @@
 
 /** Set <b>global_event_mask</b> to the bitwise OR of each live control
  * connection's event_mask field. */
-static void update_global_event_mask(void)
+void
+control_update_global_event_mask(void)
 {
   connection_t **conns;
   int n_conns, i;
@@ -455,7 +455,7 @@
 
   conn->event_mask = event_mask;
 
-  update_global_event_mask();
+  control_update_global_event_mask();
   send_control_done(conn);
   return 0;
 }

Index: or.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.610.2.1
retrieving revision 1.610.2.2
diff -u -d -r1.610.2.1 -r1.610.2.2
--- or.h	7 Jun 2005 18:03:33 -0000	1.610.2.1
+++ or.h	7 Aug 2005 19:40:17 -0000	1.610.2.2
@@ -1436,6 +1436,7 @@
 int control_event_bandwidth_used(uint32_t n_read, uint32_t n_written);
 void control_event_logmsg(int severity, const char *msg);
 int control_event_descriptors_changed(smartlist_t *routers);
+void control_update_global_event_mask(void);
 
 int init_cookie_authentication(int enabled);
 int decode_hashed_password(char *buf, const char *hashed);