added timeouts to config

This commit is contained in:
2022-02-04 15:06:56 +01:00
parent cc2c40dc56
commit 440aa41396
3 changed files with 20 additions and 7 deletions

View File

@@ -43,3 +43,11 @@ csgowtfd:
demos_expire: 30
# ms between shots to count as spray
spray_timeout: 500
# timeouts
timeout:
# seconds before incoming request with no data send timeout
read: 5
# seconds to write a response before timeout
write: 30
# seconds before closing idle connections
idle: 120

12
main.go
View File

@@ -1152,9 +1152,9 @@ func main() {
sockets = append(sockets, sL)
go func() {
srv := &http.Server{
ReadTimeout: 5 * time.Second,
WriteTimeout: 10 * time.Second,
IdleTimeout: 120 * time.Second,
ReadTimeout: time.Duration(conf.Csgowtfd.Timeout.Read) * time.Second,
WriteTimeout: time.Duration(conf.Csgowtfd.Timeout.Write) * time.Second,
IdleTimeout: time.Duration(conf.Csgowtfd.Timeout.Idle) * time.Second,
Handler: cors(proxyRouter),
}
_ = srv.Serve(sL)
@@ -1167,9 +1167,9 @@ func main() {
}
go func() {
srv := &http.Server{
ReadTimeout: 5 * time.Second,
WriteTimeout: 10 * time.Second,
IdleTimeout: 120 * time.Second,
ReadTimeout: time.Duration(conf.Csgowtfd.Timeout.Read) * time.Second,
WriteTimeout: time.Duration(conf.Csgowtfd.Timeout.Write) * time.Second,
IdleTimeout: time.Duration(conf.Csgowtfd.Timeout.Idle) * time.Second,
Handler: cors(proxyRouter),
}
err = srv.Serve(tL)

View File

@@ -64,6 +64,11 @@ type Conf struct {
SharecodeUpdate string `yaml:"sharecode_update"`
DemosExpire int `yaml:"demos_expire"`
SprayTimeout int `yaml:"spray_timeout"`
Timeout struct {
Read int
Write int
Idle int
}
}
}