Browse Source

Merge pull request #465 from libp2p/fix/mock-race-really

*really* fix the race in mock
pull/476/head
Steven Allen 6 years ago
committed by GitHub
parent
commit
91514ce02b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      p2p/net/mock/mock_stream.go

2
p2p/net/mock/mock_stream.go

@ -64,7 +64,7 @@ func (s *stream) Write(p []byte) (n int, err error) {
select {
case <-s.closed: // bail out if we're closing.
return 0, s.writeErr
case s.toDeliver <- &transportObject{msg: p, arrivalTime: t}:
case s.toDeliver <- &transportObject{msg: cpy, arrivalTime: t}:
}
return len(p), nil
}

Loading…
Cancel
Save