diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-01-28 04:34:01 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-01-28 04:34:01 +0800 |
commit | e9d017ba082bfd624267c974fa93a77da6269756 (patch) | |
tree | e9d43020c0c7544969ab7e3906053ded947a7c33 | |
parent | d8c6168d11dda55ffb10bc70601e74e347c156e1 (diff) | |
download | dexon-e9d017ba082bfd624267c974fa93a77da6269756.tar dexon-e9d017ba082bfd624267c974fa93a77da6269756.tar.gz dexon-e9d017ba082bfd624267c974fa93a77da6269756.tar.bz2 dexon-e9d017ba082bfd624267c974fa93a77da6269756.tar.lz dexon-e9d017ba082bfd624267c974fa93a77da6269756.tar.xz dexon-e9d017ba082bfd624267c974fa93a77da6269756.tar.zst dexon-e9d017ba082bfd624267c974fa93a77da6269756.zip |
Rename api var for clarity
-rw-r--r-- | rpc/http/server.go | 4 | ||||
-rw-r--r-- | rpc/ws/server.go | 9 |
2 files changed, 6 insertions, 7 deletions
diff --git a/rpc/http/server.go b/rpc/http/server.go index 631d47110..93b52a634 100644 --- a/rpc/http/server.go +++ b/rpc/http/server.go @@ -83,7 +83,7 @@ func (s *RpcHttpServer) Start() { } } -func (s *RpcHttpServer) apiHandler(xeth *rpc.EthereumApi) http.Handler { +func (s *RpcHttpServer) apiHandler(api *rpc.EthereumApi) http.Handler { fn := func(w http.ResponseWriter, req *http.Request) { rpchttplogger.Debugln("Handling request") @@ -94,7 +94,7 @@ func (s *RpcHttpServer) apiHandler(xeth *rpc.EthereumApi) http.Handler { } var response interface{} - reserr := xeth.GetRequestReply(&reqParsed, &response) + reserr := api.GetRequestReply(&reqParsed, &response) if reserr != nil { rpchttplogger.Errorln(reserr) JSON.Send(w, &rpc.RpcErrorResponse{JsonRpc: reqParsed.JsonRpc, ID: reqParsed.ID, Error: true, ErrorText: reserr.Error()}) diff --git a/rpc/ws/server.go b/rpc/ws/server.go index c275031f4..248ebc585 100644 --- a/rpc/ws/server.go +++ b/rpc/ws/server.go @@ -85,9 +85,9 @@ func (self *WebSocketServer) Start() { } } -func (s *WebSocketServer) apiHandler(xeth *rpc.EthereumApi) http.Handler { +func (s *WebSocketServer) apiHandler(api *rpc.EthereumApi) http.Handler { fn := func(w http.ResponseWriter, req *http.Request) { - h := sockHandler(xeth) + h := sockHandler(api) s := websocket.Server{Handler: h} s.ServeHTTP(w, req) } @@ -95,10 +95,9 @@ func (s *WebSocketServer) apiHandler(xeth *rpc.EthereumApi) http.Handler { return http.HandlerFunc(fn) } -func sockHandler(xeth *rpc.EthereumApi) websocket.Handler { +func sockHandler(api *rpc.EthereumApi) websocket.Handler { fn := func(conn *websocket.Conn) { for { - // FIX wslogger does not output to console wslogger.Debugln("Handling request") var reqParsed rpc.RpcRequest @@ -109,7 +108,7 @@ func sockHandler(xeth *rpc.EthereumApi) websocket.Handler { } var response interface{} - reserr := xeth.GetRequestReply(&reqParsed, &response) + reserr := api.GetRequestReply(&reqParsed, &response) if reserr != nil { wslogger.Errorln(reserr) websocket.JSON.Send(conn, rpc.RpcErrorResponse{JsonRpc: reqParsed.JsonRpc, ID: reqParsed.ID, Error: true, ErrorText: reserr.Error()}) |