Don't fail RPC server create due to single iface.

Rather than returning an error when creating the RPC server an it can't
listen on any of the specified interfaces, only error when it can't listen
on all of the specified interfaces.
This commit is contained in:
Dave Collins 2014-03-20 21:54:50 -05:00
parent eecea4180a
commit 9d6dd6fa6b

View file

@ -368,8 +368,7 @@ func newRPCServer(listenAddrs []string, s *server) (*rpcServer, error) {
listeners := make([]net.Listener, 0, listeners := make([]net.Listener, 0,
len(ipv6ListenAddrs)+len(ipv4ListenAddrs)) len(ipv6ListenAddrs)+len(ipv4ListenAddrs))
for _, addr := range ipv4ListenAddrs { for _, addr := range ipv4ListenAddrs {
var listener net.Listener listener, err := tls.Listen("tcp4", addr, &tlsConfig)
listener, err = tls.Listen("tcp4", addr, &tlsConfig)
if err != nil { if err != nil {
rpcsLog.Warnf("Can't listen on %s: %v", addr, rpcsLog.Warnf("Can't listen on %s: %v", addr,
err) err)
@ -379,8 +378,7 @@ func newRPCServer(listenAddrs []string, s *server) (*rpcServer, error) {
} }
for _, addr := range ipv6ListenAddrs { for _, addr := range ipv6ListenAddrs {
var listener net.Listener listener, err := tls.Listen("tcp6", addr, &tlsConfig)
listener, err = tls.Listen("tcp6", addr, &tlsConfig)
if err != nil { if err != nil {
rpcsLog.Warnf("Can't listen on %s: %v", addr, rpcsLog.Warnf("Can't listen on %s: %v", addr,
err) err)
@ -394,7 +392,7 @@ func newRPCServer(listenAddrs []string, s *server) (*rpcServer, error) {
rpc.listeners = listeners rpc.listeners = listeners
return &rpc, err return &rpc, nil
} }
// jsonAuthFail sends a message back to the client if the http auth is rejected. // jsonAuthFail sends a message back to the client if the http auth is rejected.