aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-11-11 00:54:53 +0000
committerNick Mathewson <nickm@torproject.org>2004-11-11 00:54:53 +0000
commit6252cba522e46dedbd250b8e2dede2e84ecb56f4 (patch)
tree20306b912840ac4a0b557d98660b1a19f46360b0 /src
parente69d9647ed084dfde64f0e1bebbc98f8380c2cc6 (diff)
downloadtor-6252cba522e46dedbd250b8e2dede2e84ecb56f4.tar
tor-6252cba522e46dedbd250b8e2dede2e84ecb56f4.tar.gz
apply patch from Andre Eisenbach: include event code with events, as required by control-spec.txt
svn:r2799
Diffstat (limited to 'src')
-rw-r--r--src/or/control.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/or/control.c b/src/or/control.c
index 5122a207b..6e558a336 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -184,15 +184,24 @@ send_control_event(uint16_t event, uint16_t len, const char *body)
{
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