summaryrefslogtreecommitdiff
path: root/evdns.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-02-10 16:32:50 -0500
committerNick Mathewson <nickm@torproject.org>2012-02-10 16:32:50 -0500
commit713e570ab42bb228eda9a712c266e259584822fb (patch)
treea1e8cf914a662180e3817233e00a23b6de9e7fff /evdns.c
parentaf6c9d8ee6e27daf558211aba83e20e33f15bd58 (diff)
downloadlibevent-713e570ab42bb228eda9a712c266e259584822fb.tar.gz
Save some syscalls when creating evdns sockets
Diffstat (limited to 'evdns.c')
-rw-r--r--evdns.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/evdns.c b/evdns.c
index f2869be5..0a89836e 100644
--- a/evdns.c
+++ b/evdns.c
@@ -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)) {