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

version» Context lines:

pike.git/lib/modules/Protocols.pmod/DNS.pmod:1972:    */    if(!next_client)    next_client=this_program(nameservers,domains);       return next_client->do_query(domain, cl, type, callback, @args);    }       protected 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) {    // Invalid request id. Spoofed answer?    // FIXME: Consider black- or greylisting the answer.    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); +  }       protected private Request generic_get(string d,    mapping answer,    int multi,    int all,    int type,    string field,    string domain,    function callback,    mixed ... args)