瀏覽代碼

update the host policy from the connection pool

Chris Bannister 10 年之前
父節點
當前提交
31a2e0157b
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      connectionpool.go

+ 6 - 0
connectionpool.go

@@ -236,6 +236,12 @@ func (p *policyConnPool) addHost(host *HostInfo) {
 	)
 
 	p.hostConnPools[host.Peer()] = pool
+
+	// update policy
+	// TODO: policy should not have conns, it should have hosts and return a host
+	// iter which the pool will use to serve conns
+	p.hostPolicy.AddHost(host)
+	p.mu.Unlock()
 }
 
 func (p *policyConnPool) removeHost(addr string) {