Save some syscalls when constructing a socket for a bufferevent

This commit is contained in:
Nick Mathewson 2012-02-10 16:33:25 -05:00
parent 713e570ab4
commit 33fca629a6

View File

@ -365,11 +365,10 @@ bufferevent_socket_connect(struct bufferevent *bev,
if (fd < 0) {
if (!sa)
goto done;
fd = socket(sa->sa_family, SOCK_STREAM, 0);
fd = evutil_socket(sa->sa_family,
SOCK_STREAM|EVUTIL_SOCK_NONBLOCK, 0);
if (fd < 0)
goto done;
if (evutil_make_socket_nonblocking(fd)<0)
goto done;
ownfd = 1;
}
if (sa) {