diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/adns.lua | 14 | ||||
-rw-r--r-- | net/server_event.lua | 2 |
2 files changed, 9 insertions, 7 deletions
diff --git a/net/adns.lua b/net/adns.lua index d1876b0f..0121881a 100644 --- a/net/adns.lua +++ b/net/adns.lua @@ -54,13 +54,15 @@ function new_async_socket(sock, resolver) end end function listener.ondisconnect(conn, err) - log("warn", "DNS socket for %s disconnected: %s", peername, err); - local servers = resolver.server; - if resolver.socketset[conn] == resolver.best_server and resolver.best_server == #servers then - log("error", "Exhausted all %d configured DNS servers, next lookup will try %s again", #servers, servers[1]); - end + if err then + log("warn", "DNS socket for %s disconnected: %s", peername, err); + local servers = resolver.server; + if resolver.socketset[conn] == resolver.best_server and resolver.best_server == #servers then + log("error", "Exhausted all %d configured DNS servers, next lookup will try %s again", #servers, servers[1]); + end - resolver:servfail(conn); -- Let the magic commence + resolver:servfail(conn); -- Let the magic commence + end end handler = server.wrapclient(sock, "dns", 53, listener); if not handler then diff --git a/net/server_event.lua b/net/server_event.lua index 610c2e7a..3456fb9e 100644 --- a/net/server_event.lua +++ b/net/server_event.lua @@ -262,7 +262,7 @@ do _ = self.eventsession and self.eventsession:close( ) _ = self.eventwritetimeout and self.eventwritetimeout:close( ) _ = self.eventreadtimeout and self.eventreadtimeout:close( ) - _ = self.ondisconnect and self:ondisconnect( self.fatalerror ) -- call ondisconnect listener (wont be the case if handshake failed on connect) + _ = self.ondisconnect and self:ondisconnect( self.fatalerror ~= "client to close" and self.fatalerror) -- call ondisconnect listener (wont be the case if handshake failed on connect) _ = self.conn and self.conn:close( ) -- close connection, must also be called outside of any socket registered events! _ = self._server and self._server:counter(-1); self.eventread, self.eventwrite = nil, nil |