[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Automatically use filtering bufferevents with IOCP.
commit d3653063d30ee8174f6ec330124553c6717fbe9c
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Thu Aug 18 15:08:49 2011 -0400
Automatically use filtering bufferevents with IOCP.
---
changes/bug3752 | 5 +++++
src/common/compat_libevent.c | 11 +++++++++++
src/common/compat_libevent.h | 1 +
src/common/tortls.c | 2 +-
4 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/changes/bug3752 b/changes/bug3752
new file mode 100644
index 0000000..270f155
--- /dev/null
+++ b/changes/bug3752
@@ -0,0 +1,5 @@
+ o Major bugfixes:
+ - The IOCP backend now works even when the user has not specified
+ the (internal, debbuging-only) _UseFilteringSSLBufferevents option.
+ Fixes part of bug 3752; bugfix on 0.2.3.1-alpha.
+
diff --git a/src/common/compat_libevent.c b/src/common/compat_libevent.c
index 8752de7..595742f 100644
--- a/src/common/compat_libevent.c
+++ b/src/common/compat_libevent.c
@@ -164,6 +164,16 @@ struct event_base *the_event_base = NULL;
#endif
#endif
+#ifdef USE_BUFFEREVENTS
+static int using_iocp_bufferevents = 0;
+
+int
+tor_libevent_using_iocp_bufferevents(void)
+{
+ return using_iocp_bufferevents;
+}
+#endif
+
/** Initialize the Libevent library and set up the event base. */
void
tor_libevent_initialize(tor_libevent_cfg *torcfg)
@@ -187,6 +197,7 @@ tor_libevent_initialize(tor_libevent_cfg *torcfg)
if (! torcfg->disable_iocp) {
evthread_use_windows_threads();
event_config_set_flag(cfg, EVENT_BASE_FLAG_STARTUP_IOCP);
+ using_iocp_bufferevents = 1;
}
#endif
diff --git a/src/common/compat_libevent.h b/src/common/compat_libevent.h
index 8669fd4..bbe105b 100644
--- a/src/common/compat_libevent.h
+++ b/src/common/compat_libevent.h
@@ -73,6 +73,7 @@ const char *tor_libevent_get_version_str(void);
#ifdef USE_BUFFEREVENTS
#define TOR_LIBEVENT_TICKS_PER_SECOND 3
const struct timeval *tor_libevent_get_one_tick_timeout(void);
+int tor_libevent_using_iocp_bufferevents(void);
#endif
#endif
diff --git a/src/common/tortls.c b/src/common/tortls.c
index 4556030..2aaa2c4 100644
--- a/src/common/tortls.c
+++ b/src/common/tortls.c
@@ -1892,7 +1892,7 @@ tor_tls_init_bufferevent(tor_tls_t *tls, struct bufferevent *bufev_in,
const enum bufferevent_ssl_state state = receiving ?
BUFFEREVENT_SSL_ACCEPTING : BUFFEREVENT_SSL_CONNECTING;
- if (filter) {
+ if (filter || tor_libevent_using_iocp_bufferevents()) {
/* Grab an extra reference to the SSL, since BEV_OPT_CLOSE_ON_FREE
means that the SSL will get freed too.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits