Repository: mesos Updated Branches: refs/heads/master abc5cd9e8 -> 4697d8c5c
SSL: defer connect callbacks. This avoids executing cleanup logic twice. Review: https://reviews.apache.org/r/36237 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/4697d8c5 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/4697d8c5 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/4697d8c5 Branch: refs/heads/master Commit: 4697d8c5cc5b0ff19273a4e7b50462dd7935b037 Parents: abc5cd9 Author: Joris Van Remoortere <[email protected]> Authored: Mon Jul 6 20:24:25 2015 -0700 Committer: Benjamin Hindman <[email protected]> Committed: Mon Jul 6 20:24:25 2015 -0700 ---------------------------------------------------------------------- 3rdparty/libprocess/src/libevent_ssl_socket.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/4697d8c5/3rdparty/libprocess/src/libevent_ssl_socket.cpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/src/libevent_ssl_socket.cpp b/3rdparty/libprocess/src/libevent_ssl_socket.cpp index 9424dd4..ab05fea 100644 --- a/3rdparty/libprocess/src/libevent_ssl_socket.cpp +++ b/3rdparty/libprocess/src/libevent_ssl_socket.cpp @@ -437,13 +437,15 @@ Future<Nothing> LibeventSSLSocketImpl::connect(const Address& address) } // Construct the bufferevent in the connecting state. + // We set 'BEV_OPT_DEFER_CALLBACKS' to avoid calling the + // 'event_callback' before 'bufferevent_socket_connect' returns. CHECK(bev == NULL); bev = bufferevent_openssl_socket_new( base, get(), ssl, BUFFEREVENT_SSL_CONNECTING, - BEV_OPT_THREADSAFE); + BEV_OPT_THREADSAFE | BEV_OPT_DEFER_CALLBACKS); if (bev == NULL) { // We need to free 'ssl' here because the bev won't clean it up
