mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
removing unnecessary function
This commit is contained in:
parent
3de74d2213
commit
a305f5a08c
1 changed files with 4 additions and 15 deletions
19
node/node.go
19
node/node.go
|
|
@ -20,7 +20,6 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
|
|
@ -377,12 +376,11 @@ func (n *Node) startHTTP(endpoint string, apis []rpc.API, modules []string, cors
|
|||
return err // TODO this should return upon failure, right?
|
||||
}
|
||||
|
||||
var ws http.Handler
|
||||
if n.httpEndpoint == n.wsEndpoint {
|
||||
ws = srv.WebsocketHandler(wsOrigins)
|
||||
}
|
||||
handler := NewHTTPHandlerStack(srv, cors, vhosts)
|
||||
// wrap handler in websocket handler only if websocket port is the same as http rpc
|
||||
handler := n.AddWebsocketHandler(NewHTTPHandlerStack(srv, cors, vhosts), ws)
|
||||
if n.httpEndpoint == n.wsEndpoint {
|
||||
handler = NewWebsocketUpgradeHandler(handler, srv.WebsocketHandler(wsOrigins))
|
||||
}
|
||||
|
||||
listener, err := rpc.StartHTTPEndpoint(endpoint, timeouts, handler)
|
||||
if err != nil {
|
||||
|
|
@ -402,15 +400,6 @@ func (n *Node) startHTTP(endpoint string, apis []rpc.API, modules []string, cors
|
|||
return nil
|
||||
}
|
||||
|
||||
// AddWebsocketHandler creates the handler stack necessary to handle both http rpc requests and websocket requests
|
||||
func (n *Node) AddWebsocketHandler(handler http.Handler, websocket http.Handler) http.Handler {
|
||||
if websocket != nil {
|
||||
return NewWebsocketUpgradeHandler(handler, websocket)
|
||||
}
|
||||
|
||||
return handler
|
||||
}
|
||||
|
||||
// stopHTTP terminates the HTTP RPC endpoint.
|
||||
func (n *Node) stopHTTP() {
|
||||
if n.httpListener != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue