fd = evutil_socket_(sa->sa_family,
SOCK_STREAM|EVUTIL_SOCK_NONBLOCK, 0);
if (fd < 0)
- goto done;
+ goto freesock;
ownfd = 1;
}
if (sa) {
goto done;
freesock:
- bufferevent_run_eventcb_(bev, BEV_EVENT_ERROR, 0);
if (ownfd)
evutil_closesocket(fd);
- /* do something about the error? */
done:
bufferevent_decref_and_unlock_(bev);
return result;
}
/* XXX use the other addrinfos? */
- /* XXX use this return value */
bufferevent_socket_set_conn_address(bev_p, ai->ai_addr, (int)ai->ai_addrlen);
r = bufferevent_socket_connect(bev, ai->ai_addr, (int)ai->ai_addrlen);
- (void)r;
+ if (r < 0)
+ bufferevent_run_eventcb_(bev, BEV_EVENT_ERROR, 0);
bufferevent_decref_and_unlock_(bev);
evutil_freeaddrinfo(ai);
}