Browse Source

New bufferevent-related check in assert_connection_ok().

{Make sure that if we have a bufferevent on a connection, we do not have the
other libevent/buffering-related fields set.}
Nick Mathewson 16 years ago
parent
commit
5448501479
1 changed files with 10 additions and 0 deletions
  1. 10 0
      src/or/connection.c

+ 10 - 0
src/or/connection.c

@@ -3406,6 +3406,16 @@ assert_connection_ok(connection_t *conn, time_t now)
   tor_assert(conn);
   tor_assert(conn->type >= _CONN_TYPE_MIN);
   tor_assert(conn->type <= _CONN_TYPE_MAX);
+
+#ifdef USE_BUFFEREVENT
+  if (conn->bufev) {
+    tor_assert(conn->read_event == NULL);
+    tor_assert(conn->write_event == NULL);
+    tor_assert(conn->inbuf == NULL);
+    tor_assert(conn->outbuf == NULL);
+  }
+#endif
+
   switch (conn->type) {
     case CONN_TYPE_OR:
       tor_assert(conn->magic == OR_CONNECTION_MAGIC);