Changeset 14237


Ignore:
Timestamp:
Jan 20, 2014, 11:18:52 PM (7 years ago)
Author:
jordan
Message:

when we free the UDP trackers on shutdown, make sure to cancel any DNS requests that are pending for them.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/announcer-udp.c

    r14225 r14237  
    432432    int port;
    433433
    434     bool is_asking_dns;
     434    struct evdns_getaddrinfo_request * dns_request;
    435435    struct evutil_addrinfo * addr;
    436436    time_t addr_expiration_time;
     
    454454    if (t->addr)
    455455        evutil_freeaddrinfo (t->addr);
     456    if (t->dns_request != NULL)
     457        evdns_getaddrinfo_cancel (t->dns_request);
    456458    tr_ptrArrayDestruct (&t->announces, (PtrArrayForeachFunc)tau_announce_request_free);
    457459    tr_ptrArrayDestruct (&t->scrapes, (PtrArrayForeachFunc)tau_scrape_request_free);
     
    494496    struct tau_tracker * tracker = vtracker;
    495497
    496     tracker->is_asking_dns = false;
     498    tracker->dns_request = NULL;
    497499
    498500    if (errcode)
     
    536538    const time_t now = tr_time ();
    537539
    538     assert (tracker->is_asking_dns == false);
     540    assert (tracker->dns_request == NULL);
    539541    assert (tracker->connecting_at == 0);
    540542    assert (tracker->addr != NULL);
     
    673675
    674676    /* if we don't have an address yet, try & get one now. */
    675     if (!tracker->addr && !tracker->is_asking_dns)
     677    if (!tracker->addr && (tracker->dns_request == NULL))
    676678    {
    677679        struct evutil_addrinfo hints;
     
    680682        hints.ai_socktype = SOCK_DGRAM;
    681683        hints.ai_protocol = IPPROTO_UDP;
    682         tracker->is_asking_dns = true;
    683684        dbgmsg (tracker->host, "Trying a new DNS lookup");
    684         evdns_getaddrinfo (tracker->session->evdns_base,
    685                            tracker->host, NULL, &hints,
    686                            tau_tracker_on_dns, tracker);
     685        tracker->dns_request = evdns_getaddrinfo (tracker->session->evdns_base,
     686                                                  tracker->host, NULL, &hints,
     687                                                  tau_tracker_on_dns, tracker);
    687688        return;
    688689    }
Note: See TracChangeset for help on using the changeset viewer.