Changeset

9916:72501e3c1427

net.server_select: Fix write pause/resume functions Nothing would happen if the write buffer was empty. Also simplified the code because it took too long to understand what `if _sendlistlen ~= tmp then` did.
author Kim Alvefur <zash@zash.se>
date Sun, 24 Mar 2019 20:12:22 +0100
parents 9915:9fe7b18bca15
children 9917:45b5528b128a
files net/server_select.lua
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_select.lua	Sun Mar 24 19:07:39 2019 +0100
+++ b/net/server_select.lua	Sun Mar 24 20:12:22 2019 +0100
@@ -497,14 +497,12 @@
 		local tmp = _sendlistlen
 		_sendlistlen = removesocket( _sendlist, socket, _sendlistlen )
 		_writetimes[ handler ] = nil
-		if _sendlistlen ~= tmp then
-			nosend = true
-		end
+		nosend = true
 	end
 	handler.resume_writes = function (self)
-		if nosend then
-			nosend = false
-			write( "" )
+		nosend = false
+		if bufferlen > 0 then
+			_sendlistlen = addsocket(_sendlist, socket, _sendlistlen)
 		end
 	end