Skip to content

Commit 84abd3f

Browse files
committed
Re-adjust the default ReadTimeout and WriteTimeout for Server to 120 seconds, the default InitialTimeout and HeartbeatTimeout remained at 10 seconds. This should reduce the disconnect problem experienced by Chrome users
1 parent 9d916db commit 84abd3f

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

application/configuration/server.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ func (s Server) defaultListenPort() uint16 {
8080

8181
// Predefined variables for normalization
8282
const (
83-
serverMinValidSecond = 1 * time.Second
84-
heartbeatTimeoutProportion = 0.7
83+
serverMinValidSecond = 1 * time.Second
84+
maxHeartbeatTimeoutProportion = 0.7
8585
)
8686

8787
// normalize fills current Server with valid settings. If a setting is
@@ -92,16 +92,16 @@ func (s Server) normalize() Server {
9292
serverMinValidSecond,
9393
)
9494
readTimeout := atLeast(
95-
setZeroUintToDefault(s.ReadTimeout, 60*time.Second),
95+
setZeroUintToDefault(s.ReadTimeout, 120*time.Second),
9696
serverMinValidSecond,
9797
)
9898
writeTimeout := atLeast(
9999
setZeroUintToDefault(s.WriteTimeout, readTimeout),
100100
serverMinValidSecond,
101101
)
102-
heartBeatTimeout := clampRange(
102+
heartbeatTimeout := clampRange(
103103
setZeroUintToDefault(s.HeartbeatTimeout, initialTimeout),
104-
time.Duration(float64(readTimeout)*heartbeatTimeoutProportion),
104+
time.Duration(float64(readTimeout)*maxHeartbeatTimeoutProportion),
105105
serverMinValidSecond,
106106
)
107107
return Server{
@@ -110,7 +110,7 @@ func (s Server) normalize() Server {
110110
InitialTimeout: initialTimeout,
111111
ReadTimeout: readTimeout,
112112
WriteTimeout: writeTimeout,
113-
HeartbeatTimeout: heartBeatTimeout,
113+
HeartbeatTimeout: heartbeatTimeout,
114114
ReadDelay: atLeast(s.ReadDelay, 0), // No less than 0
115115
WriteDelay: atLeast(s.WriteDelay, 0), // No less than 0
116116
TLSCertificateFile: s.TLSCertificateFile,

sshwifty.conf.example.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
{
1414
"ListenInterface": "127.0.0.1",
1515
"ListenPort": 8182,
16-
"InitialTimeout": 3,
17-
"ReadTimeout": 60,
18-
"WriteTimeout": 60,
19-
"HeartbeatTimeout": 20,
16+
"InitialTimeout": 10,
17+
"ReadTimeout": 120,
18+
"WriteTimeout": 120,
19+
"HeartbeatTimeout": 15,
2020
"ReadDelay": 10,
2121
"WriteDelay": 10,
2222
"TLSCertificateFile": "",

0 commit comments

Comments
 (0)