Rename RPC handlers map to rpcHandlers.

The name handlers for a package level is a bit too generic and could
easily cause a name collision.  Even though the compiler would catch it,
use something a bit more descriptive.
This commit is contained in:
Dave Collins 2013-12-31 15:53:19 -06:00
parent 835cee229a
commit 30802fdd52

View file

@ -48,7 +48,7 @@ var (
type commandHandler func(*rpcServer, btcjson.Cmd) (interface{}, error) type commandHandler func(*rpcServer, btcjson.Cmd) (interface{}, error)
// handlers maps RPC command strings to appropriate handler functions. // handlers maps RPC command strings to appropriate handler functions.
var handlers = map[string]commandHandler{ var rpcHandlers = map[string]commandHandler{
"addmultisigaddress": handleAskWallet, "addmultisigaddress": handleAskWallet,
"addnode": handleAddNode, "addnode": handleAddNode,
"backupwallet": handleAskWallet, "backupwallet": handleAskWallet,
@ -382,8 +382,8 @@ func jsonAuthFail(w http.ResponseWriter, r *http.Request, s *rpcServer) {
fmt.Fprint(w, "401 Unauthorized.\n") fmt.Fprint(w, "401 Unauthorized.\n")
} }
// jsonRPCRead is the RPC wrapper around the jsonRead function to handles // jsonRPCRead is the RPC wrapper around the jsonRead function to handle reading
// reading and responding to RPC messages. // and responding to RPC messages.
func jsonRPCRead(w http.ResponseWriter, r *http.Request, s *rpcServer) { func jsonRPCRead(w http.ResponseWriter, r *http.Request, s *rpcServer) {
r.Close = true r.Close = true
if atomic.LoadInt32(&s.shutdown) != 0 { if atomic.LoadInt32(&s.shutdown) != 0 {
@ -1079,7 +1079,7 @@ func standardCmdReply(cmd btcjson.Cmd, s *rpcServer) (reply btcjson.Reply) {
id := cmd.Id() id := cmd.Id()
reply.Id = &id reply.Id = &id
handler, ok := handlers[cmd.Method()] handler, ok := rpcHandlers[cmd.Method()]
if !ok { if !ok {
reply.Error = &btcjson.ErrMethodNotFound reply.Error = &btcjson.ErrMethodNotFound
return reply return reply