Changeset

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
parents 3397:f376f0bd1d1f
children 3400:502a634f0578
files net/server_select.lua
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
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