Browse Source

etcd: fix a race in peer.go

Xiang Li 11 years ago
parent
commit
2e59635bea
1 changed files with 1 additions and 1 deletions
  1. 1 1
      etcd/peer.go

+ 1 - 1
etcd/peer.go

@@ -89,8 +89,8 @@ func (p *peer) send(d []byte) error {
 		if p.inflight.Get() > maxInflight {
 		if p.inflight.Get() > maxInflight {
 			return fmt.Errorf("reach max idle")
 			return fmt.Errorf("reach max idle")
 		}
 		}
+		p.wg.Add(1)
 		go func() {
 		go func() {
-			p.wg.Add(1)
 			p.post(d)
 			p.post(d)
 			p.wg.Done()
 			p.wg.Done()
 		}()
 		}()