]> granicus.if.org Git - libevent/commitdiff
Add a temporary workaround for an ssl bug found on FreeBSD.
authorNick Mathewson <nickm@torproject.org>
Wed, 18 Nov 2009 21:16:53 +0000 (21:16 +0000)
committerNick Mathewson <nickm@torproject.org>
Wed, 18 Nov 2009 21:16:53 +0000 (21:16 +0000)
Basically, we only want to report the 'connected' event because of
the socket connect() finishing when we have an actual socket
bufferevent; on an SSL bufferevent, 'connected' means 'SSL
connection finished.'

This isn't FreeBSD's fault: it just has a connect() that tends to
succeed pretty early.

svn:r1548

bufferevent_sock.c

index 1ae367b1b0f9e27ad10a9fbcc09d2d76fbe11c35..44c8351c3c288477a24adfaf7b4a7e841f26aae0 100644 (file)
@@ -374,7 +374,12 @@ bufferevent_socket_connect(struct bufferevent *bev,
        } else {
                /* The connect succeeded already. How odd. */
                result = 0;
-               _bufferevent_run_eventcb(bev, BEV_EVENT_CONNECTED);
+               /* XXXX The strcmp here is a stupid hack to prevent delivering
+                * a CONNECTED to an SSL bufferevent before its SSL is done
+                * negotiating.  Really we should find some way to do this that
+                * isn't an explicit type-check. */
+               if (strcmp(bev->be_ops->type, "ssl"))
+                       _bufferevent_run_eventcb(bev, BEV_EVENT_CONNECTED);
        }
 
        goto done;