net.server_select: Prevent writes after a handler is closed (fixes #783 I hope)
authorKim Alvefur <zash@zash.se>
Tue, 22 Nov 2016 15:28:24 +0100
changeset 7739 5a07fe977002
parent 7716 003ee2be2635
child 7741 0647b821e00a
child 7772 2a7b52437167
net.server_select: Prevent writes after a handler is closed (fixes #783 I hope)
net/server_select.lua
--- a/net/server_select.lua	Thu Nov 03 23:51:40 2016 +0100
+++ b/net/server_select.lua	Tue Nov 22 15:28:24 2016 +0100
@@ -415,6 +415,7 @@
 	end
 	handler.port = handler.clientport -- COMPAT server_event
 	local write = function( self, data )
+		if not handler then return false end
 		bufferlen = bufferlen + #data
 		if bufferlen > maxsendlen then
 			_closelist[ handler ] = "send buffer exceeded"	 -- cannot close the client at the moment, have to wait to the end of the cycle