Skip to content

Commit

Permalink
Save some syscalls when creating evdns sockets
Browse files Browse the repository at this point in the history
  • Loading branch information
nmathewson committed Feb 10, 2012
1 parent af6c9d8 commit 713e570
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions evdns.c
Original file line number Diff line number Diff line change
Expand Up @@ -2439,10 +2439,9 @@ _evdns_nameserver_add_impl(struct evdns_base *base, const struct sockaddr *addre

evtimer_assign(&ns->timeout_event, ns->base->event_base, nameserver_prod_callback, ns);

ns->socket = socket(address->sa_family, SOCK_DGRAM, 0);
ns->socket = evutil_socket(address->sa_family,
SOCK_DGRAM|EVUTIL_SOCK_NONBLOCK|EVUTIL_SOCK_CLOEXEC, 0);
if (ns->socket < 0) { err = 1; goto out1; }
evutil_make_socket_closeonexec(ns->socket);
evutil_make_socket_nonblocking(ns->socket);

if (base->global_outgoing_addrlen &&
!evutil_sockaddr_is_loopback(address)) {
Expand Down

0 comments on commit 713e570

Please sign in to comment.