Skip to content

Commit

Permalink
Make timeout time configurable from the control port
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mlevogiannis committed Jul 27, 2022
1 parent 3dffdff commit c0811e2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion vncap/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit c0811e2

Please sign in to comment.