aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/http.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-20 23:02:01 +0800
committerobscuren <geffobscura@gmail.com>2015-03-20 23:02:01 +0800
commita59bb053f4d2a4a28341c645c051c4c323581a1b (patch)
tree6f414de5c01c9cc69d2ee461ca49ef1858aa1ca6 /rpc/http.go
parentdeee9cb170ff105992ede83c52013d0c2c4ad10d (diff)
parent28e1971272d5bab6aa683d3bbe711226ca1fef98 (diff)
downloaddexon-a59bb053f4d2a4a28341c645c051c4c323581a1b.tar.gz
dexon-a59bb053f4d2a4a28341c645c051c4c323581a1b.tar.zst
dexon-a59bb053f4d2a4a28341c645c051c4c323581a1b.zip
merge
Diffstat (limited to 'rpc/http.go')
-rw-r--r--rpc/http.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/rpc/http.go b/rpc/http.go
index 5f2445e6c..3dfb67781 100644
--- a/rpc/http.go
+++ b/rpc/http.go
@@ -10,7 +10,7 @@ import (
"github.com/ethereum/go-ethereum/xeth"
)
-var rpchttplogger = logger.NewLogger("RPC-HTTP")
+var rpclogger = logger.NewLogger("RPC")
const (
jsonrpcver = "2.0"
@@ -28,7 +28,7 @@ func JSONRPC(pipe *xeth.XEth, dataDir string) http.Handler {
// Limit request size to resist DoS
if req.ContentLength > maxSizeReqLength {
jsonerr := &RpcErrorObject{-32700, "Request too large"}
- Send(w, &RpcErrorResponse{Jsonrpc: jsonrpcver, Id: nil, Error: jsonerr})
+ send(w, &RpcErrorResponse{Jsonrpc: jsonrpcver, Id: nil, Error: jsonerr})
return
}
@@ -37,14 +37,14 @@ func JSONRPC(pipe *xeth.XEth, dataDir string) http.Handler {
body, err := ioutil.ReadAll(req.Body)
if err != nil {
jsonerr := &RpcErrorObject{-32700, "Could not read request body"}
- Send(w, &RpcErrorResponse{Jsonrpc: jsonrpcver, Id: nil, Error: jsonerr})
+ send(w, &RpcErrorResponse{Jsonrpc: jsonrpcver, Id: nil, Error: jsonerr})
}
// Try to parse the request as a single
var reqSingle RpcRequest
if err := json.Unmarshal(body, &reqSingle); err == nil {
response := RpcResponse(api, &reqSingle)
- Send(w, &response)
+ send(w, &response)
return
}
@@ -57,13 +57,13 @@ func JSONRPC(pipe *xeth.XEth, dataDir string) http.Handler {
response := RpcResponse(api, &request)
resBatch[i] = response
}
- Send(w, resBatch)
+ send(w, resBatch)
return
}
// Not a batch or single request, error
jsonerr := &RpcErrorObject{-32600, "Could not decode request"}
- Send(w, &RpcErrorResponse{Jsonrpc: jsonrpcver, Id: nil, Error: jsonerr})
+ send(w, &RpcErrorResponse{Jsonrpc: jsonrpcver, Id: nil, Error: jsonerr})
})
}
@@ -84,11 +84,11 @@ func RpcResponse(api *EthereumApi, request *RpcRequest) *interface{} {
response = &RpcErrorResponse{Jsonrpc: jsonrpcver, Id: request.Id, Error: jsonerr}
}
- rpchttplogger.DebugDetailf("Generated response: %T %s", response, response)
+ rpclogger.DebugDetailf("Generated response: %T %s", response, response)
return &response
}
-func Send(writer io.Writer, v interface{}) (n int, err error) {
+func send(writer io.Writer, v interface{}) (n int, err error) {
var payload []byte
payload, err = json.MarshalIndent(v, "", "\t")
if err != nil {