Diff

net/server_event.lua @ 8530:075df839c110

net.server_event: Not every instantly-readable connection is an error, continue if possible
author Matthew Wild <mwild1@gmail.com>
date Fri, 23 Feb 2018 15:41:12 +0000
parent 8529:257fd322fc9f
child 8728:41c959c5c84b
line wrap: on
line diff
--- a/net/server_event.lua	Fri Feb 23 15:33:02 2018 +0000
+++ b/net/server_event.lua	Fri Feb 23 15:41:12 2018 +0000
@@ -105,9 +105,13 @@
 			self:ontimeout()  -- call timeout listener
 			self:_close()
 			debug( "new connection failed. id:", self.id, "error:", self.fatalerror )
-		elseif EV_READWRITE == event then
-			self.readcallback(event);
 		else
+			if EV_READWRITE == event then
+				if self.readcallback(event) == -1 then
+					-- Fatal error occurred
+					return -1;
+				end
+			end
 			if plainssl and has_luasec then  -- start ssl session
 				self:starttls(self._sslctx, true)
 			else  -- normal connection