Changeset

9931:485231f8b75d 0.11

net.server_epoll: Handle LuaSec wantread/wantwrite conditions before callbacks (fixes #1333) This prevents the :set(true) call from resuming a connection that was paused in the onincoming callback.
author Kim Alvefur <zash@zash.se>
date Thu, 28 Mar 2019 12:31:14 +0100
parents 9881:68faa0c1a99c
children 9932:df73ca804719
files net/server_epoll.lua
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_epoll.lua	Mon Jan 14 00:17:02 2019 +0100
+++ b/net/server_epoll.lua	Thu Mar 28 12:31:14 2019 +0100
@@ -355,15 +355,18 @@
 		self:onconnect();
 		self:on("incoming", data);
 	else
+		if err == "wantread" then
+			self:set(true, nil);
+			err = "timeout";
+		elseif err == "wantwrite" then
+			self:set(nil, true);
+			err = "timeout";
+		end
 		if partial and partial ~= "" then
 			self:onconnect();
 			self:on("incoming", partial, err);
 		end
-		if err == "wantread" then
-			self:set(true, nil);
-		elseif err == "wantwrite" then
-			self:set(nil, true);
-		elseif err ~= "timeout" then
+		if err ~= "timeout" then
 			self:on("disconnect", err);
 			self:destroy()
 			return;