summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Fifield <david@bamsoftware.com>2020-02-21 14:27:54 -0700
committerDavid Fifield <david@bamsoftware.com>2020-02-21 20:36:07 -0700
commita05f5efc7966bcbf71d0a9410d4656a221bcb1bb (patch)
tree02a52051b715f3db86bb156ae448bdf5f97acb53
parent6b902fcad0437d2d92696a1ccc7801091d3ef667 (diff)
Set the smux KeepAliveTimeout (idle timeout) to 10 minutes.
Analogously to the quic IdleTimeout. The default KeepAliveTimeout is otherwise 30 seconds. https://github.com/xtaci/smux/blob/c6969d8a76874342611f4b544d05b1590f1a76b1/mux.go#L45 The too-short idle timeout was causing frequent hangs in the client, with a particularly bad effect. In copyLoop, the downstream socks←webRTC copy would terminate after 30 seconds of idleness (could be as soon as the first 30 seconds, if you get a bad proxy right off the bat), but the upstream webRTC←socks copy would keep running for about 2 minutes (may be the tor SocksTimeout, I'm not sure), with no opportunity to start working in that time because the downstream copy had already exited.
-rw-r--r--server/server.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/server/server.go b/server/server.go
index e67d6c9..98dc18e 100644
--- a/server/server.go
+++ b/server/server.go
@@ -311,6 +311,7 @@ func acceptStreamsKCP(conn *kcp.UDPSession) error {
smuxConfig := smux.DefaultConfig()
smuxConfig.Version = 2
+ smuxConfig.KeepAliveTimeout = 10 * time.Minute
sess, err := smux.Server(conn, smuxConfig)
if err != nil {
return err