Browse Source

rpc_laddr is a list

pull/192/head
Ethan Buchman 9 years ago
parent
commit
254693bf86
1 changed files with 16 additions and 7 deletions
  1. +16
    -7
      node/node.go

+ 16
- 7
node/node.go View File

@ -151,7 +151,7 @@ func (n *Node) AddListener(l p2p.Listener) {
n.sw.AddListener(l)
}
func (n *Node) StartRPC() (net.Listener, error) {
func (n *Node) StartRPC() ([]net.Listener, error) {
rpccore.SetBlockStore(n.blockStore)
rpccore.SetConsensusState(n.consensusState)
rpccore.SetConsensusReactor(n.consensusReactor)
@ -160,13 +160,22 @@ func (n *Node) StartRPC() (net.Listener, error) {
rpccore.SetPrivValidator(n.privValidator)
rpccore.SetGenesisDoc(n.genesisDoc)
listenAddr := config.GetString("rpc_laddr")
listenAddrs := strings.Split(config.GetString("rpc_laddr"), ",")
mux := http.NewServeMux()
wm := rpcserver.NewWebsocketManager(rpccore.Routes, n.evsw)
mux.HandleFunc("/websocket", wm.WebsocketHandler)
rpcserver.RegisterRPCFuncs(mux, rpccore.Routes)
return rpcserver.StartHTTPServer(listenAddr, mux)
// we may expose the rpc over both a unix and tcp socket
listeners := make([]net.Listener, len(listenAddrs))
for i, listenAddr := range listenAddrs {
mux := http.NewServeMux()
wm := rpcserver.NewWebsocketManager(rpccore.Routes, n.evsw)
mux.HandleFunc("/websocket", wm.WebsocketHandler)
rpcserver.RegisterRPCFuncs(mux, rpccore.Routes)
listener, err := rpcserver.StartHTTPServer(listenAddr, mux)
if err != nil {
return nil, err
}
listeners[i] = listener
}
return listeners, nil
}
func (n *Node) Switch() *p2p.Switch {


Loading…
Cancel
Save