Skip to content

Commit 99b7f22

Browse files
committed
Improve reactor tests and fix PacketPushable bug
1 parent b79cddc commit 99b7f22

3 files changed

Lines changed: 1112 additions & 6 deletions

File tree

common/bufio/packet_reactor.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,10 @@ func (r *PacketReactor) prepareStream(conn *reactorConnection, source N.PacketRe
217217
func (r *PacketReactor) registerStream(stream *reactorStream) {
218218
if stream.pushable != nil {
219219
stream.pushable.SetOnDataReady(func() {
220-
if stream.state.CompareAndSwap(stateIdle, stateActive) {
221-
go stream.runActiveLoop(nil)
222-
}
220+
go stream.runActiveLoop(nil)
223221
})
224222
if stream.pushable.HasPendingData() {
225-
if stream.state.CompareAndSwap(stateIdle, stateActive) {
226-
go stream.runActiveLoop(nil)
227-
}
223+
go stream.runActiveLoop(nil)
228224
}
229225
return
230226
}

0 commit comments

Comments
 (0)