From 62da479bf9a1c2948b830f811e6e130aca09b242 Mon Sep 17 00:00:00 2001 From: Marios Levogiannis Date: Fri, 29 Jul 2022 18:40:35 +0300 Subject: [PATCH] Make timeout time configurable from the control port (#2) This change is backwards compatible. If a "timeout" value is not submitted to the control port then the default value of 30s will be used. --- vncap/control.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vncap/control.py b/vncap/control.py index 016a72d..3ee8353 100644 --- a/vncap/control.py +++ b/vncap/control.py @@ -32,6 +32,7 @@ def lineReceived(self, line): ws = d.get("ws", False) tls = d.get("tls", False) client_opts = d.get("client", {}) + timeout_secs = d.get("timeout", 30) # Allocate the source port. sport = self.factory.allocate_port(sport) @@ -52,7 +53,7 @@ def timeout(): log.msg("Timed out connection on port %d" % sport) listening.stopListening() self.factory.free_port(sport) - reactor.callLater(30, timeout) + reactor.callLater(timeout_secs, timeout) log.msg("New forwarder (%d->%s:%d)" % (sport, host, dport)) self.sendLine("%d" % sport)