Changeset

333:8d15b073fdbe

session:disconnect() -> session:close() for consistency with other Lua APIs
author Matthew Wild <mwild1@gmail.com>
date Tue, 18 Nov 2008 19:44:54 +0000
parents 332:51e130b5c8de
children 334:bffd80e8c7a3
files core/s2smanager.lua core/sessionmanager.lua net/xmppclient_listener.lua net/xmppserver_listener.lua
diffstat 4 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/core/s2smanager.lua	Tue Nov 18 19:40:04 2008 +0000
+++ b/core/s2smanager.lua	Tue Nov 18 19:44:54 2008 +0000
@@ -139,7 +139,7 @@
 		send(stanza("stream:stream", { xmlns='jabber:server', ["xmlns:db"]='jabber:server:dialback', ["xmlns:stream"]='http://etherx.jabber.org/streams', id=session.streamid, from=session.to_host }):top_tag());
 		if session.to_host and not hosts[session.to_host] then
 			-- Attempting to connect to a host we don't serve
-			session:disconnect("host-unknown");
+			session:close("host-unknown");
 			return;
 		end
 	elseif session.direction == "outgoing" then
@@ -230,8 +230,6 @@
 		hosts[session.from_host].s2sout[session.to_host] = nil;
 	end
 	
-	session.conn = nil;
-	session.disconnect = nil;
 	for k in pairs(session) do
 		if k ~= "trace" then
 			session[k] = nil;
--- a/core/sessionmanager.lua	Tue Nov 18 19:40:04 2008 +0000
+++ b/core/sessionmanager.lua	Tue Nov 18 19:44:54 2008 +0000
@@ -113,7 +113,7 @@
 						
 						if not hosts[session.host] then
 							-- We don't serve this host...
-							session:disconnect{ condition = "host-unknown", text = "This server does not serve "..tostring(session.host)};
+							session:close{ condition = "host-unknown", text = "This server does not serve "..tostring(session.host)};
 							return;
 						end
 						
--- a/net/xmppclient_listener.lua	Tue Nov 18 19:40:04 2008 +0000
+++ b/net/xmppclient_listener.lua	Tue Nov 18 19:44:54 2008 +0000
@@ -38,7 +38,7 @@
 
 
 local stream_xmlns_attr = {xmlns='urn:ietf:params:xml:ns:xmpp-streams'};
-local function session_disconnect(session, reason)
+local function session_close(session, reason)
 	local log = session.log or log;
 	if session.conn then
 		if reason then
@@ -90,7 +90,7 @@
 		print("Client connected");
 		
 		session.reset_stream = session_reset_stream;
-		session.disconnect = session_disconnect;
+		session.close = session_close;
 		
 		session_reset_stream(session); -- Initialise, ready for use
 		
--- a/net/xmppserver_listener.lua	Tue Nov 18 19:40:04 2008 +0000
+++ b/net/xmppserver_listener.lua	Tue Nov 18 19:44:54 2008 +0000
@@ -40,7 +40,7 @@
 
 
 local stream_xmlns_attr = {xmlns='urn:ietf:params:xml:ns:xmpp-streams'};
-local function session_disconnect(session, reason)
+local function session_close(session, reason)
 	local log = session.log or log;
 	if session.conn then
 		if reason then
@@ -92,7 +92,7 @@
 		print("Incoming s2s connection");
 		
 		session.reset_stream = session_reset_stream;
-		session.disconnect = session_disconnect;
+		session.close = session_close;
 		
 		session_reset_stream(session); -- Initialise, ready for use