mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
Merge pull request #469 from gzliudan/http-server-timeout
add http.TimeoutHandler for rpc http server
This commit is contained in:
commit
5223454dee
1 changed files with 2 additions and 1 deletions
|
|
@ -237,11 +237,12 @@ func NewHTTPServer(cors []string, vhosts []string, srv *Server, writeTimeout tim
|
|||
// Wrap the CORS-handler within a host-handler
|
||||
handler := newCorsHandler(srv, cors)
|
||||
handler = newVHostHandler(vhosts, handler)
|
||||
handler = http.TimeoutHandler(handler, writeTimeout, `{"error":"http server timeout"}`)
|
||||
log.Info("NewHTTPServer", "writeTimeout", writeTimeout)
|
||||
return &http.Server{
|
||||
Handler: handler,
|
||||
ReadTimeout: 5 * time.Second,
|
||||
WriteTimeout: writeTimeout,
|
||||
WriteTimeout: writeTimeout + time.Second,
|
||||
IdleTimeout: 120 * time.Second,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue