Changeset

2662:6877179335a9

Merge with 0.7
author Matthew Wild <mwild1@gmail.com>
date Thu, 18 Feb 2010 16:46:07 +0000
parents 2658:a4879b1e6cde (current diff) 2661:be4b1e796bd2 (diff)
children 2666:ef33efdec5bb
files
diffstat 3 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/core/modulemanager.lua	Thu Feb 18 14:28:52 2010 +0500
+++ b/core/modulemanager.lua	Thu Feb 18 16:46:07 2010 +0000
@@ -158,7 +158,7 @@
 		log("error", "Error initializing module '%s' on '%s': %s", module_name, host, err or "nil");
 	end
 	if success then
-		hosts[host].events.fire_event("module-loaded", { module = module_name, host = host });
+		(hosts[api_instance.host] or prosody).events.fire_event("module-loaded", { module = module_name, host = host });
 		return true;
 	else -- load failed, unloading
 		unload(api_instance.host, module_name);
@@ -210,7 +210,7 @@
 		end
 	end
 	modulemap[host][name] = nil;
-	hosts[host].events.fire_event("module-unloaded", { module = name, host = host });
+	(hosts[host] or prosody).events.fire_event("module-unloaded", { module = name, host = host });
 	return true;
 end
 
--- a/net/adns.lua	Thu Feb 18 14:28:52 2010 +0500
+++ b/net/adns.lua	Thu Feb 18 16:46:07 2010 +0000
@@ -54,13 +54,15 @@
 		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]);
+		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
 		end
-		
-		resolver:servfail(conn); -- Let the magic commence
 	end
 	handler = server.wrapclient(sock, "dns", 53, listener);
 	if not handler then
--- a/net/server_event.lua	Thu Feb 18 14:28:52 2010 +0500
+++ b/net/server_event.lua	Thu Feb 18 16:46:07 2010 +0000
@@ -262,7 +262,7 @@
 				_ = 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