]> Cypherpunks repositories - gostls13.git/commitdiff
old/netchan: fix data race on client hashmap
authorDmitriy Vyukov <dvyukov@google.com>
Tue, 17 Jan 2012 07:48:20 +0000 (11:48 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Tue, 17 Jan 2012 07:48:20 +0000 (11:48 +0400)
Fixes #2713.

R=golang-dev, r
CC=golang-dev, mpimenov
https://golang.org/cl/5545065

src/pkg/old/netchan/common.go

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