[tor-commits] [tor/master] Search for remaining references to 'bufferevent'.

nickm at torproject.org nickm at torproject.org
Fri Aug 12 20:11:39 UTC 2016


commit 4d4ccc505b0c9639c68b42645d5a29497c48fe4d
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue Aug 2 13:59:47 2016 -0400

    Search for remaining references to 'bufferevent'.
    
    Remove or adjust as appropriate.
---
 configure.ac                 | 27 ---------------------------
 src/common/compat_libevent.h |  4 ++--
 src/or/channeltls.c          |  2 ++
 src/or/connection.c          |  6 +++---
 src/or/connection.h          |  2 --
 src/or/main.c                |  2 +-
 src/test/test_channeltls.c   |  3 +--
 7 files changed, 9 insertions(+), 37 deletions(-)

diff --git a/configure.ac b/configure.ac
index 140bd4c..bc2f515 100644
--- a/configure.ac
+++ b/configure.ac
@@ -161,9 +161,6 @@ AC_ARG_ENABLE(tor2web-mode,
     CFLAGS="$CFLAGS -D ENABLE_TOR2WEB_MODE=1"
 fi])
 
-AC_ARG_ENABLE(bufferevents,
-     AS_HELP_STRING(--enable-bufferevents, [use Libevent's buffered IO]))
-
 AC_ARG_ENABLE(tool-name-check,
      AS_HELP_STRING(--disable-tool-name-check, [check for sanely named toolchain when cross-compiling]))
 
@@ -550,30 +547,6 @@ LIBS="$save_LIBS"
 LDFLAGS="$save_LDFLAGS"
 CPPFLAGS="$save_CPPFLAGS"
 
-dnl bufferents require version 2.0.13
-if test "$enable_bufferevents" = "yes"; then
-   AC_CHECK_HEADERS(event2/bufferevent_ssl.h)
-
-   CPPFLAGS="$CPPFLAGS $TOR_CPPFLAGS_libevent"
-
-   AC_MSG_CHECKING([whether Libevent is new enough for bufferevents])
-   AC_COMPILE_IFELSE([AC_LANG_SOURCE([
-#include <event2/event.h>
-#if !defined(LIBEVENT_VERSION_NUMBER) || LIBEVENT_VERSION_NUMBER < 0x02000d00
-#error
-int x = y(zz);
-#else
-int x = 1;
-#endif
-   ])], [ AC_MSG_RESULT([yes]) ],
-      [ AC_MSG_RESULT([no])
-        AC_MSG_ERROR([Libevent does not seem new enough to support bufferevents.  We require 2.0.13-stable or later]) ] )
-fi
-
-LIBS="$save_LIBS"
-LDFLAGS="$save_LDFLAGS"
-CPPFLAGS="$save_CPPFLAGS"
-
 AC_SUBST(TOR_LIBEVENT_LIBS)
 
 dnl ------------------------------------------------------
diff --git a/src/common/compat_libevent.h b/src/common/compat_libevent.h
index 33da4fe..b1449b9 100644
--- a/src/common/compat_libevent.h
+++ b/src/common/compat_libevent.h
@@ -34,10 +34,10 @@ void periodic_timer_free(periodic_timer_t *);
 /** Defines a configuration for using libevent with Tor: passed as an argument
  * to tor_libevent_initialize() to describe how we want to set up. */
 typedef struct tor_libevent_cfg {
-  /** How many CPUs should we use (relevant only with IOCP). */
+  /** How many CPUs should we use (not currently useful). */
   int num_cpus;
   /** How many milliseconds should we allow between updating bandwidth limits?
-   * (relevant only with bufferevents). */
+   * (Not currently useful). */
   int msec_per_tick;
 } tor_libevent_cfg;
 
diff --git a/src/or/channeltls.c b/src/or/channeltls.c
index 2bb88dd..ac0c512 100644
--- a/src/or/channeltls.c
+++ b/src/or/channeltls.c
@@ -1192,6 +1192,8 @@ channel_tls_handle_var_cell(var_cell_t *var_cell, or_connection_t *conn)
        * notice "hey, data arrived!" before we notice "hey, the handshake
        * finished!" And we need to be accepting both at once to handle both
        * the v2 and v3 handshakes. */
+      /* But that should be happening any longer've disabled bufferevents. */
+      tor_assert_nonfatal_unreached_once();
 
       /* fall through */
     case OR_CONN_STATE_TLS_SERVER_RENEGOTIATING:
diff --git a/src/or/connection.c b/src/or/connection.c
index 40fc2bc..ceb2883 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -3567,8 +3567,8 @@ connection_fetch_from_buf_line(connection_t *conn, char *data,
   return fetch_from_buf_line(conn->inbuf, data, data_len);
 }
 
-/** As fetch_from_buf_http, but fetches from a connection's input buffer_t or
- * its bufferevent as appropriate. */
+/** As fetch_from_buf_http, but fetches from a connection's input buffer_t as
+ * appropriate. */
 int
 connection_fetch_from_buf_http(connection_t *conn,
                                char **headers_out, size_t max_headerlen,
@@ -3880,7 +3880,7 @@ connection_handle_write(connection_t *conn, int force)
  * Try to flush data that's waiting for a write on <b>conn</b>.  Return
  * -1 on failure, 0 on success.
  *
- * Don't use this function for regular writing; the buffers/bufferevents
+ * Don't use this function for regular writing; the buffers
  * system should be good enough at scheduling writes there.  Instead, this
  * function is for cases when we're about to exit or something and we want
  * to report it right away.
diff --git a/src/or/connection.h b/src/or/connection.h
index 6c531c0..c219ea4 100644
--- a/src/or/connection.h
+++ b/src/or/connection.h
@@ -247,8 +247,6 @@ void clock_skew_warning(const connection_t *conn, long apparent_skew,
                         int trusted, log_domain_mask_t domain,
                         const char *received, const char *source);
 
-#define connection_type_uses_bufferevent(c) (0)
-
 #ifdef CONNECTION_PRIVATE
 STATIC void connection_free_(connection_t *conn);
 
diff --git a/src/or/main.c b/src/or/main.c
index 0a689ba..a48b482 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -1977,7 +1977,7 @@ systemd_watchdog_callback(periodic_timer_t *timer, void *arg)
 static periodic_timer_t *refill_timer = NULL;
 
 /** Libevent callback: invoked periodically to refill token buckets
- * and count r/w bytes. It is only used when bufferevents are disabled. */
+ * and count r/w bytes. */
 static void
 refill_callback(periodic_timer_t *timer, void *arg)
 {
diff --git a/src/test/test_channeltls.c b/src/test/test_channeltls.c
index 394612f..bde46a2 100644
--- a/src/test/test_channeltls.c
+++ b/src/test/test_channeltls.c
@@ -124,8 +124,7 @@ test_channeltls_num_bytes_queued(void *arg)
    * Next, we have to test ch->num_bytes_queued, which is
    * channel_tls_num_bytes_queued_method.  We can't mock
    * connection_get_outbuf_len() directly because it's static inline
-   * in connection.h, but we can mock buf_datalen().  Note that
-   * if bufferevents ever work, this will break with them enabled.
+   * in connection.h, but we can mock buf_datalen().
    */
 
   tt_assert(ch->num_bytes_queued != NULL);





More information about the tor-commits mailing list