mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-07 19:31:01 -04:00
evdns: disable probing with EVDNS_BASE_DISABLE_WHEN_INACTIVE
When user install EVDNS_BASE_DISABLE_WHEN_INACTIVE flag for evdns base, we must remove the timer that is used for probing, if current dns server failed, otherwise it won't break the loop.
This commit is contained in:
parent
a60632a1ec
commit
610410b586
8
evdns.c
8
evdns.c
@ -662,6 +662,7 @@ request_finished(struct request *const req, struct request **head, int free_hand
|
||||
req->ns->requests_inflight == 0 &&
|
||||
req->base->disable_when_inactive) {
|
||||
event_del(&req->ns->event);
|
||||
evtimer_del(&req->ns->timeout_event);
|
||||
}
|
||||
|
||||
if (!req->request_appended) {
|
||||
@ -2198,9 +2199,10 @@ evdns_request_transmit_to(struct request *req, struct nameserver *server) {
|
||||
ASSERT_VALID_REQUEST(req);
|
||||
|
||||
if (server->requests_inflight == 1 &&
|
||||
req->base->disable_when_inactive &&
|
||||
event_add(&server->event, NULL) < 0) {
|
||||
return 1;
|
||||
req->base->disable_when_inactive) {
|
||||
if (event_add(&server->event, NULL) < 0 ||
|
||||
evtimer_add(&req->ns->timeout_event, &req->base->global_nameserver_probe_initial_timeout) < 0)
|
||||
return 1;
|
||||
}
|
||||
|
||||
r = sendto(server->socket, (void*)req->request, req->request_len, 0,
|
||||
|
Loading…
x
Reference in New Issue
Block a user