diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-03-02 22:29:58 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-03-02 22:29:58 +0000 |
commit | f90ccf5648309152e5d10b941cd3eb6cb0dce21a (patch) | |
tree | e5f6d2f344abb7852e7a6f1476f1cdbd990f564f /src/or/control.c | |
parent | 4b5e213a0b91bcb6b3b848625f8ce6dd39381d6e (diff) | |
download | tor-f90ccf5648309152e5d10b941cd3eb6cb0dce21a.tar.gz tor-f90ccf5648309152e5d10b941cd3eb6cb0dce21a.zip |
Implement new controller events for changed descriptors and new (not-yet-attached) streams.
svn:r3731
Diffstat (limited to 'src/or/control.c')
-rw-r--r-- | src/or/control.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/or/control.c b/src/or/control.c index a23c54bc4f..4024fd4274 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -871,6 +871,31 @@ control_event_logmsg(int severity, const char *msg) send_control_event(EVENT_WARNING, (uint32_t)(len+1), msg); } +/** DOCDOC */ +int control_event_descriptors_changed(smartlist_t *routers) +{ + size_t len; + char *msg; + smartlist_t *identities; + char buf[HEX_DIGEST_LEN+1]; + + if (!EVENT_IS_INTERESTING(EVENT_NEW_DESC)) + return 0; + identities = smartlist_create(); + SMARTLIST_FOREACH(routers, routerinfo_t *, r, + { + base16_encode(buf,sizeof(buf),r->identity_digest,DIGEST_LEN); + smartlist_add(identities, tor_strdup(buf)); + }); + msg = smartlist_join_strings(identities, ",", 1, &len); + send_control_event(EVENT_NEW_DESC, len+1, msg); + + SMARTLIST_FOREACH(identities, char *, cp, tor_free(cp)); + smartlist_free(identities); + tor_free(msg); + return 0; +} + /** Choose a random authentication cookie and write it to disk. * Anybody who can read the cookie from disk will be considered * authorized to use the control connection. */ |