mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-26 11:11:41 +00:00
remove "rpc" prefix from package imports
This commit is contained in:
@ -11,9 +11,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
. "github.com/tendermint/go-common"
|
||||
. "github.com/tendermint/go-rpc/types"
|
||||
//"github.com/tendermint/go-wire"
|
||||
types "github.com/tendermint/go-rpc/types"
|
||||
)
|
||||
|
||||
func StartHTTPServer(listenAddr string, handler http.Handler) (listener net.Listener, err error) {
|
||||
@ -24,14 +22,14 @@ func StartHTTPServer(listenAddr string, handler http.Handler) (listener net.List
|
||||
log.Warn("WARNING (go-rpc): Please use fully formed listening addresses, including the tcp:// or unix:// prefix")
|
||||
// we used to allow addrs without tcp/unix prefix by checking for a colon
|
||||
// TODO: Deprecate
|
||||
proto = SocketType(listenAddr)
|
||||
proto = types.SocketType(listenAddr)
|
||||
addr = listenAddr
|
||||
// return nil, fmt.Errorf("Invalid listener address %s", lisenAddr)
|
||||
} else {
|
||||
proto, addr = parts[0], parts[1]
|
||||
}
|
||||
|
||||
log.Notice(Fmt("Starting RPC HTTP server on %s socket %v", proto, addr))
|
||||
log.Notice(fmt.Sprintf("Starting RPC HTTP server on %s socket %v", proto, addr))
|
||||
listener, err = net.Listen(proto, addr)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Failed to listen to %v: %v", listenAddr, err)
|
||||
@ -47,7 +45,7 @@ func StartHTTPServer(listenAddr string, handler http.Handler) (listener net.List
|
||||
return listener, nil
|
||||
}
|
||||
|
||||
func WriteRPCResponseHTTP(w http.ResponseWriter, res RPCResponse) {
|
||||
func WriteRPCResponseHTTP(w http.ResponseWriter, res types.RPCResponse) {
|
||||
// jsonBytes := wire.JSONBytesPretty(res)
|
||||
jsonBytes, err := json.Marshal(res)
|
||||
if err != nil {
|
||||
@ -83,13 +81,13 @@ func RecoverAndLogHandler(handler http.Handler) http.Handler {
|
||||
if e := recover(); e != nil {
|
||||
|
||||
// If RPCResponse
|
||||
if res, ok := e.(RPCResponse); ok {
|
||||
if res, ok := e.(types.RPCResponse); ok {
|
||||
WriteRPCResponseHTTP(rww, res)
|
||||
} else {
|
||||
// For the rest,
|
||||
log.Error("Panic in RPC HTTP handler", "error", e, "stack", string(debug.Stack()))
|
||||
rww.WriteHeader(http.StatusInternalServerError)
|
||||
WriteRPCResponseHTTP(rww, NewRPCResponse("", nil, Fmt("Internal Server Error: %v", e)))
|
||||
WriteRPCResponseHTTP(rww, types.NewRPCResponse("", nil, fmt.Sprintf("Internal Server Error: %v", e)))
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user