diff --git a/client/lib/snowflake.go b/client/lib/snowflake.go index 7442ce9..77c784e 100644 --- a/client/lib/snowflake.go +++ b/client/lib/snowflake.go @@ -32,6 +32,7 @@ import ( "math/rand" "net" "net/url" + "os" "strings" "time" @@ -385,6 +386,14 @@ func newSession(snowflakes SnowflakeCollector) (net.PacketConn, *smux.Session, e 0, // default resend 1, // nc=1 => congestion window off ) + if os.Getenv("SNOWFLAKE_TEST_KCP_FAST3MODE") == "1" { + conn.SetNoDelay( + 1, + 10, + 2, + 1, + ) + } // On the KCP connection we overlay an smux session and stream. smuxConfig := smux.DefaultConfig() smuxConfig.Version = 2 diff --git a/server/lib/snowflake.go b/server/lib/snowflake.go index d7d0c40..b158f03 100644 --- a/server/lib/snowflake.go +++ b/server/lib/snowflake.go @@ -41,6 +41,7 @@ import ( "log" "net" "net/http" + "os" "sync" "time" @@ -265,6 +266,14 @@ func (l *SnowflakeListener) acceptSessions(ln *kcp.Listener) error { 0, // default resend 1, // nc=1 => congestion window off ) + if os.Getenv("SNOWFLAKE_TEST_KCP_FAST3MODE") == "1" { + conn.SetNoDelay( + 1, + 10, + 2, + 1, + ) + } go func() { defer conn.Close() err := l.acceptStreams(conn)