mirror of
https://github.com/cuberite/libevent.git
synced 2025-08-04 09:46:23 -04:00
Save some syscalls when constructing a socket for a bufferevent
This commit is contained in:
parent
713e570ab4
commit
33fca629a6
@ -365,11 +365,10 @@ bufferevent_socket_connect(struct bufferevent *bev,
|
|||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
if (!sa)
|
if (!sa)
|
||||||
goto done;
|
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)
|
if (fd < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (evutil_make_socket_nonblocking(fd)<0)
|
|
||||||
goto done;
|
|
||||||
ownfd = 1;
|
ownfd = 1;
|
||||||
}
|
}
|
||||||
if (sa) {
|
if (sa) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user