Skip to content

Commit

Permalink
Merge pull request #2856 from ipfs/fix/send-msg-race
Browse files Browse the repository at this point in the history
pass reference to reader instead of using the one on the object
  • Loading branch information
whyrusleeping committed Jun 15, 2016
2 parents e5e2f2c + 63c8a9e commit 87d0526
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions routing/dht/dht_net.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ func (ms *messageSender) SendRequest(ctx context.Context, pmes *pb.Message) (*pb

func (ms *messageSender) ctxReadMsg(ctx context.Context, mes *pb.Message) error {
errc := make(chan error, 1)
go func() {
errc <- ms.r.ReadMsg(mes)
}()
go func(r ggio.ReadCloser) {
errc <- r.ReadMsg(mes)
}(ms.r)

select {
case err := <-errc:
Expand Down

0 comments on commit 87d0526

Please sign in to comment.