Diff

net/server_select.lua @ 2603:3a77cc94b85c

Merge with trunk.
author Waqas Hussain <waqas20@gmail.com>
date Fri, 12 Feb 2010 02:50:57 +0500
parent 2598:8a021b304765
child 2728:3f8d9319d4a3
child 2996:b0515ed4d9d7
line wrap: on
line diff
--- a/net/server_select.lua	Fri Feb 12 02:43:02 2010 +0500
+++ b/net/server_select.lua	Fri Feb 12 02:50:57 2010 +0500
@@ -55,8 +55,8 @@
 
 --// extern libs //--
 
-local luasec = select( 2, pcall( require, "ssl" ) )
-local luasocket = require "socket"
+local luasec = use "ssl"
+local luasocket = use "socket" or require "socket"
 
 --// extern lib methods //--
 
@@ -472,7 +472,7 @@
 			_sendlistlen = removesocket( _sendlist, socket, _sendlistlen ) -- delete socket from writelist
 			_ = needtls and handler:starttls(nil, true)
 			_writetimes[ handler ] = nil
-		_ = toclose and handler.close( )
+			_ = toclose and handler.close( )
 			return true
 		elseif byte and ( err == "timeout" or err == "wantwrite" ) then -- want write
 			buffer = string_sub( buffer, byte + 1, bufferlen ) -- new buffer
@@ -601,8 +601,10 @@
 			handler.readbuffer = _readbuffer
 			handler.sendbuffer = _sendbuffer
 		end
+	else
+		handler.readbuffer = _readbuffer
+		handler.sendbuffer = _sendbuffer
 	end
-
 	send = socket.send
 	receive = socket.receive
 	shutdown = ( ssl and id ) or socket.shutdown