Diff

net/server_select.lua @ 3398:abc4a52aef02

net.server_select: Remove 'now' parameter from starttls(), and base it on whether the sendbuffer is empty instead
author Matthew Wild <mwild1@gmail.com>
date Thu, 22 Jul 2010 13:19:37 +0100
parent 3382:fea0f8e19e4c
child 3458:9c3ae41e696c
line wrap: on
line diff
--- a/net/server_select.lua	Thu Jul 22 13:13:28 2010 +0100
+++ b/net/server_select.lua	Thu Jul 22 13:19:37 2010 +0100
@@ -483,7 +483,7 @@
 			if drain then
 				drain(handler)
 			end
-			_ = needtls and handler:starttls(nil, true)
+			_ = needtls and handler:starttls(nil)
 			_ = toclose and handler:close( )
 			return true
 		elseif byte and ( err == "timeout" or err == "wantwrite" ) then -- want write
@@ -564,13 +564,13 @@
 			end
 		else
 			local sslctx;
-			handler.starttls = function( self, _sslctx, now )
+			handler.starttls = function( self, _sslctx)
 				if _sslctx then
 					sslctx = _sslctx;
 					handler:set_sslctx(sslctx);
 				end
-				if not now then
-					out_put "server.lua: we need to do tls, but delaying until later"
+				if bufferqueuelen > 0 then
+					out_put "server.lua: we need to do tls, but delaying until send buffer empty"
 					needtls = true
 					return
 				end