Diff

plugins/mod_c2s.lua @ 11514:11186af62c87

Merge 0.11->trunk
author Kim Alvefur <zash@zash.se>
date Sat, 10 Apr 2021 16:45:44 +0200
parent 11477:c90ef8745779
parent 11511:cab64a0aad49
child 11517:f7275c2c58fa
line wrap: on
line diff
--- a/plugins/mod_c2s.lua	Tue Apr 06 23:23:28 2021 +0200
+++ b/plugins/mod_c2s.lua	Sat Apr 10 16:45:44 2021 +0200
@@ -210,12 +210,12 @@
 				if not session.destroyed then
 					session.log("warn", "Failed to receive a stream close response, closing connection anyway...");
 					sm_destroy_session(session, reason_text);
-					conn:close();
+					if conn then conn:close(); end
 				end
 			end);
 		else
 			sm_destroy_session(session, reason_text);
-			conn:close();
+			if conn then conn:close(); end
 		end
 	else
 		local reason_text = (reason and (reason.name or reason.text or reason.condition)) or reason;
@@ -246,11 +246,19 @@
 end, 200);
 
 function runner_callbacks:ready()
-	self.data.conn:resume();
+	if self.data.conn then
+		self.data.conn:resume();
+	else
+		(self.data.log or log)("debug", "Session has no connection to resume");
+	end
 end
 
 function runner_callbacks:waiting()
-	self.data.conn:pause();
+	if self.data.conn then
+		self.data.conn:pause();
+	else
+		(self.data.log or log)("debug", "Session has no connection to pause while waiting");
+	end
 end
 
 function runner_callbacks:error(err)