]> granicus.if.org Git - libevent/commitdiff
Remove dead code from bufferevent_socket_connect
authorNikita Gorskikh <ngorskikh@adguard.com>
Fri, 18 Sep 2020 13:34:34 +0000 (16:34 +0300)
committerNikita Gorskikh <ngorskikh@adguard.com>
Sat, 19 Sep 2020 16:14:22 +0000 (19:14 +0300)
bufferevent_sock.c

index eca7b315f874486b2a8556d29e9c06d752fe84cd..873fe7e98eade50d53babd7c6b45f647a57ce1ac 100644 (file)
@@ -396,7 +396,7 @@ bufferevent_socket_connect(struct bufferevent *bev,
                fd = evutil_socket_(sa->sa_family,
                    SOCK_STREAM|EVUTIL_SOCK_NONBLOCK, 0);
                if (fd < 0)
-                       goto freesock;
+                       goto done;
                ownfd = 1;
        }
        if (sa) {
@@ -431,16 +431,11 @@ bufferevent_socket_connect(struct bufferevent *bev,
                        result = 0;
                        goto done;
                }
-       } else if (r == 1) {
+       } else {
                /* The connect succeeded already. How very BSD of it. */
                result = 0;
                bufev_p->connecting = 1;
                bufferevent_trigger_nolock_(bev, EV_WRITE, BEV_OPT_DEFER_CALLBACKS);
-       } else {
-               /* The connect failed already.  How very BSD of it. */
-               result = 0;
-               bufferevent_run_eventcb_(bev, BEV_EVENT_ERROR, BEV_OPT_DEFER_CALLBACKS);
-               bufferevent_disable(bev, EV_WRITE|EV_READ);
        }
 
        goto done;