]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Always defer bufferevent_openssl callbacks to avoid reentrant invocations
authorNick Mathewson <nickm@torproject.org>
Mon, 27 Sep 2010 17:02:11 +0000 (13:02 -0400)
committerNick Mathewson <nickm@torproject.org>
Mon, 27 Sep 2010 18:29:42 +0000 (14:29 -0400)
src/common/tortls.c

index d9f1d875d2368f594bd19d3f30e97589117596db..bd6840af70dc5746c0ccfc40d04cec7321538f6f 100644 (file)
@@ -1710,12 +1710,16 @@ tor_tls_init_bufferevent(tor_tls_t *tls, struct bufferevent *bufev_in,
     bufferevent_free(bufev_in);
   }
   tls->state = TOR_TLS_ST_BUFFEREVENT;
+
+  /* Current versions (as of 2.0.7-rc) of Libevent need to defer
+   * bufferevent_openssl callbacks, or else our callback functions will
+   * get called reentrantly, which is bad for us.
+   */
   out = bufferevent_openssl_socket_new(tor_libevent_get_base(),
                                        socket,
                                        tls->ssl,
                                        state,
-                                       0);
-                                       //BEV_OPT_DEFER_CALLBACKS);
+                                       BEV_OPT_DEFER_CALLBACKS);
 #endif
   return out;
 }