rpc: make HTTP RPC timeouts configurable, raise defaults (#17240)
* rpc: Make HTTP server timeout values configurable * rpc: Remove flags for setting HTTP Timeouts, configuring via .toml is sufficient. * rpc: Replace separate constants with a single default struct. * rpc: Update HTTP Server Read and Write Timeouts to 30s. * rpc: Remove redundant NewDefaultHTTPTimeouts function. * rpc: document HTTPTimeouts. * rpc: sanitize timeout values for library use
This commit is contained in:
		
				
					committed by
					
						 Péter Szilágyi
						Péter Szilágyi
					
				
			
			
				
	
			
			
			
						parent
						
							c4a1d4fecf
						
					
				
				
					commit
					5d7e18539e
				
			| @@ -23,7 +23,7 @@ import ( | ||||
| ) | ||||
|  | ||||
| // StartHTTPEndpoint starts the HTTP RPC endpoint, configured with cors/vhosts/modules | ||||
| func StartHTTPEndpoint(endpoint string, apis []API, modules []string, cors []string, vhosts []string) (net.Listener, *Server, error) { | ||||
| func StartHTTPEndpoint(endpoint string, apis []API, modules []string, cors []string, vhosts []string, timeouts HTTPTimeouts) (net.Listener, *Server, error) { | ||||
| 	// Generate the whitelist based on the allowed modules | ||||
| 	whitelist := make(map[string]bool) | ||||
| 	for _, module := range modules { | ||||
| @@ -47,7 +47,7 @@ func StartHTTPEndpoint(endpoint string, apis []API, modules []string, cors []str | ||||
| 	if listener, err = net.Listen("tcp", endpoint); err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
| 	go NewHTTPServer(cors, vhosts, handler).Serve(listener) | ||||
| 	go NewHTTPServer(cors, vhosts, timeouts, handler).Serve(listener) | ||||
| 	return listener, handler, err | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user