Browse Source

session: update the host if it exists in the ring on connect

Chris Bannister 9 years ago
parent
commit
2cbb8f1069
1 changed files with 4 additions and 1 deletions
  1. 4 1
      session.go

+ 4 - 1
session.go

@@ -149,7 +149,10 @@ func NewSession(cfg ClusterConfig) (*Session, error) {
 
 	for _, host := range hosts {
 		if s.cfg.HostFilter == nil || s.cfg.HostFilter.Accept(host) {
-			s.ring.addHost(host)
+			if existingHost, ok := s.ring.addHostIfMissing(host); ok {
+				existingHost.update(host)
+			}
+
 			s.handleNodeUp(net.ParseIP(host.Peer()), host.Port(), false)
 		}
 	}