Skip to content
Snippets Groups Projects
Commit fe37229f authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

Protocols.DNS: Improved error handling when calling async callbacks.

Do not complain if the originator for an asynchronous request has
gone away.

Do not output a misleading message about failing to read the UDP
packet or connection refused, if it is the user callback that fails.

Fixes #10057.
parent 0bd6f501
No related merge requests found
......@@ -141,7 +141,6 @@ testfont binary
/lib/modules/Parser.pmod/module.pmod foreign_ident
/lib/modules/Pike.pmod foreign_ident
/lib/modules/Pike.pmod/module.pmod foreign_ident
/lib/modules/Protocols.pmod/DNS.pmod foreign_ident
/lib/modules/Protocols.pmod/HTTP.pmod/Query.pike foreign_ident
/lib/modules/Protocols.pmod/HTTP.pmod/Session.pike foreign_ident
/lib/modules/Protocols.pmod/IMAP.pmod/imap_server.pike foreign_ident
......
// $Id: DNS.pmod,v 1.81 2003/10/21 03:10:39 nilsson Exp $
// $Id$
// Not yet finished -- Fredrik Hubinette
//! Domain Name System
......@@ -1132,18 +1132,28 @@ class async_client
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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment