r8841@totoro: nickm | 2006-10-02 15:59:21 -0400

Add EXTENDED_EVENTS to the USEFEATURE command; move flag from connection_t into control_conn, since we will probably grow more of these.


svn:r8585
This commit is contained in:
Nick Mathewson 2006-10-03 18:58:56 +00:00
parent c796adc7df
commit 55bd42d50f
2 changed files with 11 additions and 5 deletions

View File

@ -999,7 +999,7 @@ handle_control_setevents(control_connection_t *conn, uint32_t len,
smartlist_free(events); smartlist_free(events);
} }
conn->event_mask = event_mask; conn->event_mask = event_mask;
conn->_base.control_events_are_extended = extended; conn->use_extended_events = extended;
control_update_global_event_mask(); control_update_global_event_mask();
send_control_done(conn); send_control_done(conn);
@ -2315,13 +2315,16 @@ handle_control_usefeature(control_connection_t *conn,
{ {
tor_assert(! STATE_IS_V0(conn->_base.state)); tor_assert(! STATE_IS_V0(conn->_base.state));
smartlist_t *args; smartlist_t *args;
int verbose_names = 0, bad = 0; int verbose_names = 0, extended_events = 0;
int bad = 0;
args = smartlist_create(); args = smartlist_create();
smartlist_split_string(args, body, " ", smartlist_split_string(args, body, " ",
SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0); SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0);
SMARTLIST_FOREACH(args, const char *, arg, { SMARTLIST_FOREACH(args, const char *, arg, {
if (!strcasecmp(arg, "VERBOSE_NAMES")) if (!strcasecmp(arg, "VERBOSE_NAMES"))
verbose_names = 1; verbose_names = 1;
if (!strcasecmp(arg, "EXTENDED_EVENTS"))
extended_events = 1;
else { else {
connection_printf_to_buf(conn, "552 Unrecognized feature \"%s\"\r\n", connection_printf_to_buf(conn, "552 Unrecognized feature \"%s\"\r\n",
arg); arg);
@ -2335,6 +2338,8 @@ handle_control_usefeature(control_connection_t *conn,
conn->use_long_names = 1; conn->use_long_names = 1;
control_update_global_event_mask(); control_update_global_event_mask();
} }
if (extended_events)
conn->use_extended_events = 1;
send_control_done(conn); send_control_done(conn);
} }

View File

@ -642,9 +642,6 @@ typedef struct connection_t {
unsigned edge_has_sent_end:1; /**< For debugging; only used on edge unsigned edge_has_sent_end:1; /**< For debugging; only used on edge
* connections. Set once we've set the stream end, * connections. Set once we've set the stream end,
* and check in circuit_about_to_close_connection(). */ * and check in circuit_about_to_close_connection(). */
/** For control connections only. If set, we send extended info with control
* events as appropriate. */
unsigned int control_events_are_extended:1;
/** Used for OR conns that shouldn't get any new circs attached to them. */ /** Used for OR conns that shouldn't get any new circs attached to them. */
unsigned int or_is_obsolete:1; unsigned int or_is_obsolete:1;
/** For AP connections only. If 1, and we fail to reach the chosen exit, /** For AP connections only. If 1, and we fail to reach the chosen exit,
@ -789,6 +786,10 @@ typedef struct control_connection_t {
unsigned int use_long_names:1; /**< True if we should use long nicknames unsigned int use_long_names:1; /**< True if we should use long nicknames
* on this (v1) connection. Only settable * on this (v1) connection. Only settable
* via v1 controllers. */ * via v1 controllers. */
/** For control connections only. If set, we send extended info with control
* events as appropriate. */
unsigned int use_extended_events:1;
uint32_t incoming_cmd_len; uint32_t incoming_cmd_len;
uint32_t incoming_cmd_cur_len; uint32_t incoming_cmd_cur_len;
char *incoming_cmd; char *incoming_cmd;