]> granicus.if.org Git - libevent/commitdiff
Only send a connected event _after_ we've adjusted the SSL state.
authorNick Mathewson <nickm@torproject.org>
Fri, 14 Aug 2009 20:07:09 +0000 (20:07 +0000)
committerNick Mathewson <nickm@torproject.org>
Fri, 14 Aug 2009 20:07:09 +0000 (20:07 +0000)
This is important if the callback adjusts it to something else.

svn:r1416

bufferevent_openssl.c

index aa38f44f1f947968adcc9762c0c4c3e7a1261265..90d72283d08ce92927ab8b019ec862e54de32085 100644 (file)
@@ -796,12 +796,12 @@ do_handshake(struct bufferevent_openssl *bev_ssl)
 
        if (r==1) {
                /* We're done! */
-               _bufferevent_run_eventcb(&bev_ssl->bev.bev,
-                   BEV_EVENT_CONNECTED);
                bev_ssl->state = BUFFEREVENT_SSL_OPEN;
                set_open_callbacks(bev_ssl, -1);
                /* Call do_read and do_write as needed */
                bufferevent_enable(&bev_ssl->bev.bev, bev_ssl->bev.bev.enabled);
+               _bufferevent_run_eventcb(&bev_ssl->bev.bev,
+                   BEV_EVENT_CONNECTED);
                return 1;
        } else {
                int err = SSL_get_error(bev_ssl->ssl, r);