pike.git / lib / modules / Protocols.pmod / DNS.pmod

version» Context lines:

pike.git/lib/modules/Protocols.pmod/DNS.pmod:1865:    array(mixed) args)    {    int retries;    int timestamp = time();       //! Cancel the current request.    void cancel()    {    remove(this_object());    } +  mixed retry_co;    };       mapping requests=([]);       protected void remove(object(Request) r)    {    if(!r) return;    sscanf(r->req,"%2c",int id);    m_delete(requests,id); -  +  if (r->retry_co) remove_call_out(r->retry_co); +  r->retry_co = UNDEFINED;    r->callback && r->callback(r->domain,0,@r->args);    destruct(r);    }   }      #define REMOVE_DELAY 120   #define GIVE_UP_DELAY (RETRIES * RETRY_DELAY + REMOVE_DELAY)*2      // FIXME: Randomized source port!   //! Asynchronous DNS client.
pike.git/lib/modules/Protocols.pmod/DNS.pmod:1896:    inherit client;    inherit Stdio.UDP : udp;    async_client next_client;       void retry(object(Request) r, void|int nsno)    {    if(!r) return;    if (nsno >= sizeof(nameservers)) {    if(r->retries++ > RETRIES)    { -  call_out(remove,REMOVE_DELAY,r); +  r->retry_co = call_out(remove, REMOVE_DELAY, r);    return;    } else {    nsno = 0;    }    }       send(nameservers[nsno],53,r->req); -  call_out(retry,RETRY_DELAY,r,nsno+1); +  r->retry_co = call_out(retry, RETRY_DELAY, r, nsno+1);    }       //! Enqueue a new raw DNS request.    //!    //! @returns    //! Returns a @[Request] object.    //!    //! @note    //! Pike versions prior to 8.0 did not return the @[Request] object.    Request do_query(string domain, int cl, int type,
pike.git/lib/modules/Protocols.pmod/DNS.pmod:1928:    for(int e=next_client ? 100 : 256;e>=0;e--)    {    int lid = random(65536);    if(!catch { requests[lid]++; })    {    string req=low_mkquery(lid,domain,cl,type);       object r = Request(domain, req, callback, args);    requests[lid]=r;    udp::send(nameservers[0],53,r->req); -  call_out(retry,RETRY_DELAY,r,1); +  r->retry_co = call_out(retry, RETRY_DELAY, r, 1);    return r;    }    }       /* We failed miserably to find a request id to use,    * so we create a second UDP port to be able to have more    * requests 'in the air'. /Hubbe    */    if(!next_client)    next_client=this_program(nameservers,domains);