Skip to content

Commit

Permalink
Fix: Potential data/write conflicts (#1336)
Browse files Browse the repository at this point in the history
* rebase to master to merge #1343

* make consumer is not nil

* revert test case

* revert test case
  • Loading branch information
gunli authored Mar 7, 2025
1 parent 802aa69 commit 042bfcd
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions pulsar/internal/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,26 +411,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 data := <-c.writeRequestsCh:
if data == nil {
return
Expand Down

0 comments on commit 042bfcd

Please sign in to comment.