1
0
mirror of https://github.com/golang/go synced 2024-11-25 09:27:57 -07:00

old/netchan: fix data race on client hashmap

Fixes #2713.

R=golang-dev, r
CC=golang-dev, mpimenov
https://golang.org/cl/5545065
This commit is contained in:
Dmitriy Vyukov 2012-01-17 11:48:20 +04:00
parent 994e0646d8
commit 8e99016c80

View File

@ -165,9 +165,11 @@ func (cs *clientSet) sync(timeout time.Duration) error {
deadline := time.Now().Add(timeout) deadline := time.Now().Add(timeout)
// seq remembers the clients and their seqNum at point of entry. // seq remembers the clients and their seqNum at point of entry.
seq := make(map[unackedCounter]int64) seq := make(map[unackedCounter]int64)
cs.mu.Lock()
for client := range cs.clients { for client := range cs.clients {
seq[client] = client.seq() seq[client] = client.seq()
} }
cs.mu.Unlock()
for { for {
pending := false pending := false
cs.mu.Lock() cs.mu.Lock()