added timeouts to config
This commit is contained in:
@@ -42,4 +42,12 @@ csgowtfd:
|
|||||||
# days in which demos expire
|
# days in which demos expire
|
||||||
demos_expire: 30
|
demos_expire: 30
|
||||||
# ms between shots to count as spray
|
# ms between shots to count as spray
|
||||||
spray_timeout: 500
|
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
12
main.go
@@ -1152,9 +1152,9 @@ func main() {
|
|||||||
sockets = append(sockets, sL)
|
sockets = append(sockets, sL)
|
||||||
go func() {
|
go func() {
|
||||||
srv := &http.Server{
|
srv := &http.Server{
|
||||||
ReadTimeout: 5 * time.Second,
|
ReadTimeout: time.Duration(conf.Csgowtfd.Timeout.Read) * time.Second,
|
||||||
WriteTimeout: 10 * time.Second,
|
WriteTimeout: time.Duration(conf.Csgowtfd.Timeout.Write) * time.Second,
|
||||||
IdleTimeout: 120 * time.Second,
|
IdleTimeout: time.Duration(conf.Csgowtfd.Timeout.Idle) * time.Second,
|
||||||
Handler: cors(proxyRouter),
|
Handler: cors(proxyRouter),
|
||||||
}
|
}
|
||||||
_ = srv.Serve(sL)
|
_ = srv.Serve(sL)
|
||||||
@@ -1167,9 +1167,9 @@ func main() {
|
|||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
srv := &http.Server{
|
srv := &http.Server{
|
||||||
ReadTimeout: 5 * time.Second,
|
ReadTimeout: time.Duration(conf.Csgowtfd.Timeout.Read) * time.Second,
|
||||||
WriteTimeout: 10 * time.Second,
|
WriteTimeout: time.Duration(conf.Csgowtfd.Timeout.Write) * time.Second,
|
||||||
IdleTimeout: 120 * time.Second,
|
IdleTimeout: time.Duration(conf.Csgowtfd.Timeout.Idle) * time.Second,
|
||||||
Handler: cors(proxyRouter),
|
Handler: cors(proxyRouter),
|
||||||
}
|
}
|
||||||
err = srv.Serve(tL)
|
err = srv.Serve(tL)
|
||||||
|
@@ -64,6 +64,11 @@ type Conf struct {
|
|||||||
SharecodeUpdate string `yaml:"sharecode_update"`
|
SharecodeUpdate string `yaml:"sharecode_update"`
|
||||||
DemosExpire int `yaml:"demos_expire"`
|
DemosExpire int `yaml:"demos_expire"`
|
||||||
SprayTimeout int `yaml:"spray_timeout"`
|
SprayTimeout int `yaml:"spray_timeout"`
|
||||||
|
Timeout struct {
|
||||||
|
Read int
|
||||||
|
Write int
|
||||||
|
Idle int
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user