Changeset

1953:64538c620450

Merge with 0.5
author Matthew Wild <mwild1@gmail.com>
date Wed, 14 Oct 2009 14:12:14 +0100
parents 1950:a1d186c8c65a (current diff) 1952:4a15b176fca8 (diff)
children 1955:a9a8ef70d14c
files net/server.lua net/xmppserver_listener.lua
diffstat 2 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/net/server.lua	Tue Oct 13 11:13:52 2009 +0100
+++ b/net/server.lua	Wed Oct 14 14:12:14 2009 +0100
@@ -371,18 +371,20 @@
                 send( socket, table_concat( bufferqueue, "", 1, bufferqueuelen ), 1, bufferlen )    -- forced send
             end
         end
-        if not handler then return true; end
-        _ = shutdown and shutdown( socket )
-        socket:close( )
-        _sendlistlen = removesocket( _sendlist, socket, _sendlistlen )
-        _socketlist[ socket ] = nil
+        if socket then
+          _ = shutdown and shutdown( socket )
+          socket:close( )
+          _sendlistlen = removesocket( _sendlist, socket, _sendlistlen )
+          _socketlist[ socket ] = nil
+          socket = nil
+        else
+          out_put "server.lua: socket already closed"
+        end
         if handler then
             _writetimes[ handler ] = nil
             _closelist[ handler ] = nil
             handler = nil
         end
-        socket = nil
-        --mem_free( )
 	if server then
 		server.remove( )
 	end
--- a/net/xmppserver_listener.lua	Tue Oct 13 11:13:52 2009 +0100
+++ b/net/xmppserver_listener.lua	Wed Oct 14 14:12:14 2009 +0100
@@ -100,6 +100,9 @@
 			end
 		end
 		session.sends2s("</stream:stream>");
+		if sesson.notopen or not session.conn.close() then
+			session.conn.close(true); -- Force FIXME: timer?
+		end
 		session.conn.close();
 		xmppserver.disconnect(session.conn, "stream error");
 	end