Skip to content

Commit 17f80cc

Browse files
committed
rpc: set timeouts for http server, see #16859
1 parent 143c434 commit 17f80cc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

rpc/http.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,12 @@ func NewHTTPServer(cors []string, vhosts []string, srv *Server) *http.Server {
165165
// Wrap the CORS-handler within a host-handler
166166
handler := newCorsHandler(srv, cors)
167167
handler = newVHostHandler(vhosts, handler)
168-
return &http.Server{Handler: handler}
168+
return &http.Server{
169+
Handler: handler,
170+
ReadTimeout: 5 * time.Second,
171+
WriteTimeout: 10 * time.Second,
172+
IdleTimeout: 120 * time.Second,
173+
}
169174
}
170175

171176
// ServeHTTP serves JSON-RPC requests over HTTP.

0 commit comments

Comments
 (0)