mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcd: fix datarace in peer.go
This commit is contained in:
parent
b8b5734689
commit
7adb765660
@ -48,6 +48,7 @@ func (p *peer) participate() {
|
||||
p.queue = make(chan []byte)
|
||||
p.status = participant
|
||||
for i := 0; i < maxInflight; i++ {
|
||||
p.wg.Add(1)
|
||||
go p.handle(p.queue)
|
||||
}
|
||||
}
|
||||
@ -72,11 +73,10 @@ func (p *peer) stop() {
|
||||
}
|
||||
|
||||
func (p *peer) handle(queue chan []byte) {
|
||||
p.wg.Add(1)
|
||||
defer p.wg.Done()
|
||||
for d := range queue {
|
||||
p.post(d)
|
||||
}
|
||||
p.wg.Done()
|
||||
}
|
||||
|
||||
func (p *peer) send(d []byte) error {
|
||||
|
Loading…
x
Reference in New Issue
Block a user