Default RPC server listener to localhost.

This commit is contained in:
Dave Collins 2013-11-19 17:33:07 -06:00
parent 5d13288174
commit f5a7dcdcbf

View File

@ -347,10 +347,18 @@ func loadConfig() (*config, []string, error) {
cfg.DisableRPC = true cfg.DisableRPC = true
} }
if len(cfg.RPCListeners) == 0 { // Default RPC to listen on localhost only.
cfg.RPCListeners = []string{ if !cfg.DisableRPC && len(cfg.RPCListeners) == 0 {
net.JoinHostPort("", activeNetParams.rpcPort), addrs, err := net.LookupHost("localhost")
if err != nil {
return nil, nil, err
} }
cfg.RPCListeners = make([]string, 0, len(addrs))
for _, addr := range addrs {
addr = net.JoinHostPort(addr, activeNetParams.rpcPort)
cfg.RPCListeners = append(cfg.RPCListeners, addr)
}
} }
// Add default port to all listener addresses if needed and remove // Add default port to all listener addresses if needed and remove