Skip to content

Commit

Permalink
Merge pull request #346 from ploxiln/pop_no_transaction
Browse files Browse the repository at this point in the history
producer: handle case of no transactions in popTransaction()
  • Loading branch information
ploxiln authored Aug 1, 2022
2 parents 827b836 + 0056705 commit 0e8d7a7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,17 @@ exit:
}

func (w *Producer) popTransaction(frameType int32, data []byte) {
if len(w.transactions) == 0 {
dataLen := len(data)
if dataLen > 32 {
data = data[:32]
}
w.log(LogLevelError,
"(%s) unexpected response type=%d len=%d data[:32]=0x%x",
w.conn.String(), frameType, dataLen, data)
w.close()
return
}
t := w.transactions[0]
w.transactions = w.transactions[1:]
if frameType == FrameTypeError {
Expand Down

0 comments on commit 0e8d7a7

Please sign in to comment.