Skip to content

Commit

Permalink
fix potential data/write conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
gunli committed Feb 24, 2025
1 parent 020b55c commit d746a9b
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions pulsar/internal/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,27 +418,16 @@ func (c *connection) run() {
c.log.Debugf("Connection run starting with request capacity=%d queued=%d",
cap(c.incomingRequestsCh), len(c.incomingRequestsCh))

go func() {
for {
select {
case <-c.closeCh:
c.failLeftRequestsWhenClose()
return

case req := <-c.incomingRequestsCh:
if req == nil {
return // TODO: this never gonna be happen
}
c.internalSendRequest(req)
}
}
}()

for {
select {
case <-c.closeCh:
c.failLeftRequestsWhenClose()
return

case req := <-c.incomingRequestsCh:
if req == nil {
return // TODO: this never gonna be happen
}
c.internalSendRequest(req)
case cmd := <-c.incomingCmdCh:
c.internalReceivedCommand(cmd.cmd, cmd.headersAndPayload)
case data := <-c.writeRequestsCh:
Expand Down

0 comments on commit d746a9b

Please sign in to comment.