Changeset

444:12c1be0044c6

client: Send whitespace keeplives This is to prevent net.server from timing out connections.
author Kim Alvefur <zash@zash.se>
date Sun, 06 Jun 2021 16:43:36 +0200
parents 443:89526c890363
children 445:b119dc4d8bc2
files client.lua init.lua
diffstat 2 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/client.lua	Wed Feb 17 14:57:59 2021 +0100
+++ b/client.lua	Sun Jun 06 16:43:36 2021 +0200
@@ -91,6 +91,7 @@
 
 	self:hook("connected", function () self:reopen(); end);
 	self:hook("incoming-raw", function (data) return self.data(self.conn, data); end);
+	self:hook("read-timeout", function () self:send(" "); return true; end, -1);
 
 	self.curr_id = 0;
 
--- a/init.lua	Wed Feb 17 14:57:59 2021 +0100
+++ b/init.lua	Sun Jun 06 16:43:36 2021 +0200
@@ -244,6 +244,9 @@
 		stream:event("status", new_status);
 	end
 
+	function conn_listener.onreadtimeout(conn)
+		return stream:event("read-timeout");
+	end
 	return conn_listener;
 end