summaryrefslogtreecommitdiff
path: root/src/or/control.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2009-08-09 11:40:28 -0700
committerNick Mathewson <nickm@torproject.org>2010-09-27 12:31:13 -0400
commitddcb59bb70457e203247931aaad3a3ff8b923f97 (patch)
tree803eac2d836936d44043b7793f4e6706208504cd /src/or/control.c
parent5279036148ca158f7c60f793f401604060b1c1ba (diff)
downloadtor-ddcb59bb70457e203247931aaad3a3ff8b923f97.tar.gz
tor-ddcb59bb70457e203247931aaad3a3ff8b923f97.zip
Fix more remaining users of inbuf/outbuf to handle bufferevents instead.
Diffstat (limited to 'src/or/control.c')
-rw-r--r--src/or/control.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/or/control.c b/src/or/control.c
index ac004b5582..37ebfd88dc 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -2753,6 +2753,17 @@ is_valid_initial_command(control_connection_t *conn, const char *cmd)
* interfaces is broken. */
#define MAX_COMMAND_LINE_LENGTH (1024*1024)
+static int
+peek_connection_has_control0_command(connection_t *conn)
+{
+ IF_HAS_BUFFEREVENT(conn, {
+ struct evbuffer *input = bufferevent_get_input(conn->bufev);
+ return peek_evbuffer_has_control0_command(input);
+ }) ELSE_IF_NO_BUFFEREVENT {
+ return peek_buf_has_control0_command(conn->inbuf);
+ }
+}
+
/** Called when data has arrived on a v1 control connection: Try to fetch
* commands from conn->inbuf, and execute them.
*/
@@ -2775,7 +2786,7 @@ connection_control_process_inbuf(control_connection_t *conn)
}
if (conn->_base.state == CONTROL_CONN_STATE_NEEDAUTH &&
- peek_buf_has_control0_command(conn->_base.inbuf)) {
+ peek_connection_has_control0_command(TO_CONN(conn))) {
/* Detect v0 commands and send a "no more v0" message. */
size_t body_len;
char buf[128];