diff options
author | Paweł Bylica <pawel.bylica@imapp.pl> | 2015-03-03 01:46:55 +0800 |
---|---|---|
committer | Paweł Bylica <pawel.bylica@imapp.pl> | 2015-03-03 01:46:55 +0800 |
commit | 24003c76d12b83602ca93be375a3bc19f4fb3f1b (patch) | |
tree | 90e77c349df52806d78693f93704b92786fcb693 /rpc/http/server.go | |
parent | 9c6d9dfc5c9fdd9aeb8f4d9926ed98008b849f2e (diff) | |
parent | 65cad14f9b27db396d036f47814d4843d947ac43 (diff) | |
download | go-tangerine-24003c76d12b83602ca93be375a3bc19f4fb3f1b.tar go-tangerine-24003c76d12b83602ca93be375a3bc19f4fb3f1b.tar.gz go-tangerine-24003c76d12b83602ca93be375a3bc19f4fb3f1b.tar.bz2 go-tangerine-24003c76d12b83602ca93be375a3bc19f4fb3f1b.tar.lz go-tangerine-24003c76d12b83602ca93be375a3bc19f4fb3f1b.tar.xz go-tangerine-24003c76d12b83602ca93be375a3bc19f4fb3f1b.tar.zst go-tangerine-24003c76d12b83602ca93be375a3bc19f4fb3f1b.zip |
Merge remote-tracking branch 'upstream/develop' into evmjit
Diffstat (limited to 'rpc/http/server.go')
-rw-r--r-- | rpc/http/server.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/rpc/http/server.go b/rpc/http/server.go index dd6ba68e3..452b7c9af 100644 --- a/rpc/http/server.go +++ b/rpc/http/server.go @@ -29,8 +29,8 @@ import ( var rpchttplogger = logger.NewLogger("RPC-HTTP") var JSON rpc.JsonWrapper -func NewRpcHttpServer(pipe *xeth.XEth, port int) (*RpcHttpServer, error) { - sport := fmt.Sprintf("127.0.0.1:%d", port) +func NewRpcHttpServer(pipe *xeth.XEth, address string, port int) (*RpcHttpServer, error) { + sport := fmt.Sprintf("%s:%d", address, port) l, err := net.Listen("tcp", sport) if err != nil { return nil, err @@ -41,6 +41,7 @@ func NewRpcHttpServer(pipe *xeth.XEth, port int) (*RpcHttpServer, error) { quit: make(chan bool), pipe: pipe, port: port, + addr: address, }, nil } @@ -49,6 +50,7 @@ type RpcHttpServer struct { listener net.Listener pipe *xeth.XEth port int + addr string } func (s *RpcHttpServer) exitHandler() { @@ -69,7 +71,7 @@ func (s *RpcHttpServer) Stop() { } func (s *RpcHttpServer) Start() { - rpchttplogger.Infof("Starting RPC-HTTP server on port %d", s.port) + rpchttplogger.Infof("Starting RPC-HTTP server on %s:%d", s.addr, s.port) go s.exitHandler() api := rpc.NewEthereumApi(s.pipe) @@ -92,7 +94,7 @@ func (s *RpcHttpServer) apiHandler(api *rpc.EthereumApi) http.Handler { reqParsed, reqerr := JSON.ParseRequestBody(req) if reqerr != nil { - jsonerr := &rpc.RpcErrorObject{-32700, rpc.ErrorParseRequest} + jsonerr := &rpc.RpcErrorObject{-32700, "Error: Could not parse request"} JSON.Send(w, &rpc.RpcErrorResponse{JsonRpc: jsonrpcver, ID: nil, Error: jsonerr}) return } |