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

version» Context lines:

pike.git/lib/modules/Protocols.pmod/DNS.pmod:1: - // $Id: DNS.pmod,v 1.81 2003/10/21 03:10:39 nilsson Exp $ + // $Id$   // Not yet finished -- Fredrik Hubinette      //! Domain Name System   //! RFC 1035      #pike __REAL_VERSION__      constant NOERROR=0;   constant FORMERR=1;   constant SERVFAIL=2;
pike.git/lib/modules/Protocols.pmod/DNS.pmod:1125:    */    if(!next_client)    next_client=async_client(nameservers,domains);       next_client->do_query(domain, cl, type, callback, @args);    }       static private void rec_data(mapping m)    {    mixed err; +  mapping res;    if (err = catch {    if(m->port != 53 || !has_value(nameservers, m->ip)) return;    sscanf(m->data,"%2c",int id);    object r=requests[id];    if(!r) return;    m_delete(requests,id); -  r->callback(r->domain,decode_res(m->data),@r->args); -  destruct(r); +  res = decode_res(m->data);    }) {    werror("DNS: Failed to read UDP packet. Connection refused?\n%s\n",    describe_backtrace(err));    } -  +  // NB: The callback may have gone away during our processing. +  // Don't complain if that is the case. +  if (r->callback && (err = catch { +  r->callback(r->domain, res, @r->args); +  })) { +  werror("DNS: Callback failed:\n" +  "%s\n", +  describe_backtrace(err));    } -  +  destruct(r); +  }       static private void generic_get(string d,    mapping answer,    int multi,    int all,    int type,    string field,    string domain,    function callback,    mixed ... args)