Diff

net/server_select.lua @ 3312:12fc7e005e8b

Merge 0.7->trunk
author Matthew Wild <mwild1@gmail.com>
date Fri, 02 Jul 2010 17:44:14 +0100
parent 3021:bf3c4195c5f8
parent 3311:88cfe1bba690
child 3382:fea0f8e19e4c
line wrap: on
line diff
--- a/net/server_select.lua	Fri Jul 02 17:43:01 2010 +0100
+++ b/net/server_select.lua	Fri Jul 02 17:44:14 2010 +0100
@@ -343,9 +343,9 @@
 			_closelist[ handler ] = nil
 			handler = nil
 		end
-	if server then
-		server.remove( )
-	end
+		if server then
+			server.remove( )
+		end
 		out_put "server.lua: closed client handler and removed socket from list"
 		return true
 	end
@@ -479,11 +479,11 @@
 			bufferqueuelen = 0
 			bufferlen = 0
 			_sendlistlen = removesocket( _sendlist, socket, _sendlistlen ) -- delete socket from writelist
-			_ = needtls and handler:starttls(nil, true)
 			_writetimes[ handler ] = nil
 			if drain then
 				drain(handler)
 			end
+			_ = needtls and handler:starttls(nil, true)
 			_ = toclose and handler:close( )
 			return true
 		elseif byte and ( err == "timeout" or err == "wantwrite" ) then -- want write