Skip to content

Commit

Permalink
rafthttp: fix race in TestStreamWriterAttachOutgoingConn
Browse files Browse the repository at this point in the history
Fixes #6230
  • Loading branch information
Anthony Romano committed Aug 20, 2016
1 parent 262c98f commit 784c444
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions rafthttp/stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,10 @@ func TestStreamWriterAttachOutgoingConn(t *testing.T) {
}
}

// msgc has been swapped with a new one now that prevwfc is closed
msgc, ok := sw.writec()
if !ok {
t.Errorf("#%d: working status = %v, want true", i, ok)
}
// if prevwfc != nil, the new msgc is ready since prevwfc has closed
// if prevwfc == nil, the first connection may be pending, but the first
// msgc is already available since it's set on calling startStreamwriter
msgc, _ := sw.writec()
msgc <- raftpb.Message{}

select {
Expand Down

0 comments on commit 784c444

Please sign in to comment.