Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions bufferevent_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,13 @@ bufferevent_connect_getaddrinfo_cb(int result, struct evutil_addrinfo *ai,
evutil_freeaddrinfo(ai);
return;
}

// found this called with ai == NULL
if (!ai) {
bufferevent_run_eventcb_(bev, BEV_EVENT_ERROR, 0);
bufferevent_decref_and_unlock_(bev);
return;
}

/* XXX use the other addrinfos? */
bufferevent_socket_set_conn_address_(bev, ai->ai_addr, (int)ai->ai_addrlen);
Expand Down
4 changes: 2 additions & 2 deletions evdns.c
Original file line number Diff line number Diff line change
Expand Up @@ -5355,7 +5355,7 @@ evdns_ttl_expired(int result, short what, void *arg)
EVDNS_UNLOCK(base);
}

static void
void
evdns_cache_write(struct evdns_base *dns_base, char *nodename, struct evutil_addrinfo *res, int ttl)
{
struct timeval tv;
Expand All @@ -5382,7 +5382,7 @@ evdns_cache_write(struct evdns_base *dns_base, char *nodename, struct evutil_add
EVDNS_UNLOCK(dns_base);
}

static int
int
evdns_cache_lookup(struct evdns_base *base,
const char *nodename, struct evutil_addrinfo *hints, ev_uint16_t port,
struct evutil_addrinfo **res)
Expand Down
6 changes: 4 additions & 2 deletions http.c
Original file line number Diff line number Diff line change
Expand Up @@ -1323,8 +1323,10 @@ evhttp_connection_free(struct evhttp_connection *evcon)

if (evcon->http_server != NULL) {
struct evhttp *http = evcon->http_server;
TAILQ_REMOVE(&http->connections, evcon, next);
http->connection_cnt--;
if (!TAILQ_EMPTY(&http->connections)) {
TAILQ_REMOVE(&http->connections, evcon, next);
http->connection_cnt--;
}
}

if (event_initialized(&evcon->retry_ev)) {
Expand Down
23 changes: 23 additions & 0 deletions include/event2/dns.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,29 @@ void evdns_base_free(struct evdns_base *base, int fail_requests);
EVENT2_EXPORT_SYMBOL
void evdns_base_clear_host_addresses(struct evdns_base *base);

/**
Write an entry to the evdns cache

@param dns_base the evdns base to add the entry to
@param nodename the DNS name
@param res the address information associated with the DNS name
@param ttl the time to live associated with the address information
*/
EVENT2_EXPORT_SYMBOL
void evdns_cache_write(struct evdns_base *dns_base, char *nodename, struct evutil_addrinfo *res, int ttl);

/**
Lookup an entry from the evdns cache

@param base the evdns base associated with the cache
@param nodename the DNS name for which information is being sought
@param hints see man getaddrinfo()
@param port used to fill in port numbers in the resulting address list
@param res pointer to an evutil_addrinfo struct for result
*/
EVENT2_EXPORT_SYMBOL
int evdns_cache_lookup(struct evdns_base *base, const char *nodename, struct evutil_addrinfo *hints, ev_uint16_t port, struct evutil_addrinfo **res);

/**
Convert a DNS error code to a string.

Expand Down