[or-cvs] apply patch from Andre Eisenbach: include event code with e...

Nick Mathewson nickm at seul.org
Thu Nov 11 00:54:56 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv2620

Modified Files:
	control.c 
Log Message:
apply patch from Andre Eisenbach: include event code with events, as required by control-spec.txt

Index: control.c
===================================================================
RCS file: /home/or/cvsroot/src/or/control.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- control.c	9 Nov 2004 17:15:17 -0000	1.22
+++ control.c	11 Nov 2004 00:54:53 -0000	1.23
@@ -184,15 +184,24 @@
 {
   connection_t **conns;
   int n_conns, i;
+  size_t buflen;
+  char *buf;
+
+  buflen = len + 2;
+  buf = tor_malloc_zero(buflen);
+  set_uint16(buf, htons(event));
+  memcpy(buf+2, body, len);
 
   get_connection_array(&conns, &n_conns);
   for (i = 0; i < n_conns; ++i) {
     if (conns[i]->type == CONN_TYPE_CONTROL &&
         conns[i]->state == CONTROL_CONN_STATE_OPEN &&
         conns[i]->event_mask & (1<<event)) {
-      send_control_message(conns[i], CONTROL_CMD_EVENT, len, body);
+      send_control_message(conns[i], CONTROL_CMD_EVENT, (uint16_t)(buflen), buf);
     }
   }
+
+  tor_free(buf); 
 }
 
 /** Called when we receive a SETCONF message: parse the body and try



More information about the tor-commits mailing list