瀏覽代碼

control: ensure we dont not have a bad connection in recoonect

Chris Bannister 7 年之前
父節點
當前提交
8cf6eca782
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      control.go

+ 4 - 2
control.go

@@ -341,10 +341,12 @@ func (c *controlConn) reconnect(refreshring bool) {
 	if host != nil {
 		// try to connect to the old host
 		conn, err := c.session.connect(host, c)
-		if err != nil && c.session.cfg.ConvictionPolicy.AddFailure(err, host) {
+		if err != nil {
 			// host is dead
 			// TODO: this is replicated in a few places
-			c.session.handleNodeDown(host.ConnectAddress(), host.Port())
+			if c.session.cfg.ConvictionPolicy.AddFailure(err, host) {
+				c.session.handleNodeDown(host.ConnectAddress(), host.Port())
+			}
 		} else {
 			newConn = conn
 		}