Merge pull request #507 from ngtuna/rpc

rpc: set timeouts for http server
This commit is contained in:
Tuna 2019-05-06 14:14:03 +07:00 committed by GitHub
commit b43bf82d58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -153,7 +153,12 @@ func NewHTTPServer(cors []string, vhosts []string, srv *Server) *http.Server {
// Wrap the CORS-handler within a host-handler
handler := newCorsHandler(srv, cors)
handler = newVHostHandler(vhosts, handler)
return &http.Server{Handler: handler}
return &http.Server{
Handler: handler,
ReadTimeout: 5 * time.Second,
WriteTimeout: 10 * time.Second,
IdleTimeout: 120 * time.Second,
}
}
// ServeHTTP serves JSON-RPC requests over HTTP.