diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-02-10 16:32:50 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-02-10 16:32:50 -0500 |
commit | 713e570ab42bb228eda9a712c266e259584822fb (patch) | |
tree | a1e8cf914a662180e3817233e00a23b6de9e7fff /evdns.c | |
parent | af6c9d8ee6e27daf558211aba83e20e33f15bd58 (diff) | |
download | libevent-713e570ab42bb228eda9a712c266e259584822fb.tar.gz |
Save some syscalls when creating evdns sockets
Diffstat (limited to 'evdns.c')
-rw-r--r-- | evdns.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -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)) { |