removing some unnecessary whitespace

This commit is contained in:
renaynay 2020-03-25 15:31:08 +01:00
parent 74cd4f2fd0
commit 8766f6ac81
No known key found for this signature in database
GPG key ID: 731E44FAAFCD0274
2 changed files with 0 additions and 9 deletions

View file

@ -378,7 +378,6 @@ func (n *Node) startHTTP(endpoint string, apis []rpc.API, modules []string, cors
if n.httpEndpoint == n.wsEndpoint { if n.httpEndpoint == n.wsEndpoint {
ws = srv.WebsocketHandler(wsOrigins) ws = srv.WebsocketHandler(wsOrigins)
} }
// wrap handler in websocket handler only if websocket port is the same as http rpc // wrap handler in websocket handler only if websocket port is the same as http rpc
handler := n.AddWebsocketHandler(rpc.NewHTTPHandlerStack(srv, cors, vhosts), ws) handler := n.AddWebsocketHandler(rpc.NewHTTPHandlerStack(srv, cors, vhosts), ws)
@ -389,11 +388,9 @@ func (n *Node) startHTTP(endpoint string, apis []rpc.API, modules []string, cors
n.log.Info("HTTP endpoint opened", "url", fmt.Sprintf("http://%v/", listener.Addr()), n.log.Info("HTTP endpoint opened", "url", fmt.Sprintf("http://%v/", listener.Addr()),
"cors", strings.Join(cors, ","), "cors", strings.Join(cors, ","),
"vhosts", strings.Join(vhosts, ",")) "vhosts", strings.Join(vhosts, ","))
if n.httpEndpoint == n.wsEndpoint { if n.httpEndpoint == n.wsEndpoint {
n.log.Info("WebSocket endpoint opened", "url", fmt.Sprintf("ws://%v", listener.Addr())) n.log.Info("WebSocket endpoint opened", "url", fmt.Sprintf("ws://%v", listener.Addr()))
} }
// All listeners booted successfully // All listeners booted successfully
n.httpEndpoint = endpoint n.httpEndpoint = endpoint
n.httpListener = listener n.httpListener = listener
@ -701,13 +698,11 @@ func registerApisFromWhitelist(apis []rpc.API, modules []string, srv *rpc.Server
if bad, available := rpc.CheckModuleAvailability(modules, apis); len(bad) > 0 { if bad, available := rpc.CheckModuleAvailability(modules, apis); len(bad) > 0 {
log.Error("Unavailable modules in HTTP API list", "unavailable", bad, "available", available) log.Error("Unavailable modules in HTTP API list", "unavailable", bad, "available", available)
} }
// Generate the whitelist based on the allowed modules // Generate the whitelist based on the allowed modules
whitelist := make(map[string]bool) whitelist := make(map[string]bool)
for _, module := range modules { for _, module := range modules {
whitelist[module] = true whitelist[module] = true
} }
// Register all the APIs exposed by the services // Register all the APIs exposed by the services
for _, api := range apis { for _, api := range apis {
if whitelist[api.Namespace] || (len(whitelist) == 0 && api.Public) { if whitelist[api.Namespace] || (len(whitelist) == 0 && api.Public) {
@ -717,6 +712,5 @@ func registerApisFromWhitelist(apis []rpc.API, modules []string, srv *rpc.Server
log.Debug("HTTP registered", "namespace", api.Namespace) log.Debug("HTTP registered", "namespace", api.Namespace)
} }
} }
return nil return nil
} }

View file

@ -53,7 +53,6 @@ func StartHTTPEndpoint(endpoint string, apis []API, modules []string, timeouts H
if listener, err = net.Listen("tcp", endpoint); err != nil { if listener, err = net.Listen("tcp", endpoint); err != nil {
return nil, err return nil, err
} }
// Make sure timeout values are meaningful // Make sure timeout values are meaningful
if timeouts.ReadTimeout < time.Second { if timeouts.ReadTimeout < time.Second {
log.Warn("Sanitizing invalid HTTP read timeout", "provided", timeouts.ReadTimeout, "updated", DefaultHTTPTimeouts.ReadTimeout) log.Warn("Sanitizing invalid HTTP read timeout", "provided", timeouts.ReadTimeout, "updated", DefaultHTTPTimeouts.ReadTimeout)
@ -67,7 +66,6 @@ func StartHTTPEndpoint(endpoint string, apis []API, modules []string, timeouts H
log.Warn("Sanitizing invalid HTTP idle timeout", "provided", timeouts.IdleTimeout, "updated", DefaultHTTPTimeouts.IdleTimeout) log.Warn("Sanitizing invalid HTTP idle timeout", "provided", timeouts.IdleTimeout, "updated", DefaultHTTPTimeouts.IdleTimeout)
timeouts.IdleTimeout = DefaultHTTPTimeouts.IdleTimeout timeouts.IdleTimeout = DefaultHTTPTimeouts.IdleTimeout
} }
// Bundle and start the HTTP server // Bundle and start the HTTP server
httpSrv := &http.Server{ httpSrv := &http.Server{
Handler: handler, Handler: handler,
@ -75,7 +73,6 @@ func StartHTTPEndpoint(endpoint string, apis []API, modules []string, timeouts H
WriteTimeout: timeouts.WriteTimeout, WriteTimeout: timeouts.WriteTimeout,
IdleTimeout: timeouts.IdleTimeout, IdleTimeout: timeouts.IdleTimeout,
} }
go httpSrv.Serve(listener) go httpSrv.Serve(listener)
return listener, err return listener, err
} }