Skip to content

Commit

Permalink
fix: Fix potential panic in receiver if a connection is lost
Browse files Browse the repository at this point in the history
  • Loading branch information
driskell committed Jul 30, 2024
1 parent d702ce1 commit 3615aa3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lc-lib/receiver/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,11 @@ func (r *Pool) Acknowledge(events []*event.Event) {
// ackEventsEvent processes the acknowledgement, updating any pending partial acknowledgement schedules
func (r *Pool) ackEventsEvent(ctx context.Context, connection interface{}, nonce *string, sequence uint32) {
status, ok := r.connectionStatus[connection]
if !ok || len(status.progress) == 0 {
if !ok {
// Connection was lost and this was a late acknowledgement, abandon
return
}
if len(status.progress) == 0 {
panic(fmt.Sprintf("Out of order acknowledgement: Nonce=%x; Sequence=%d; ExpectedNonce=<none>; ExpectedSequenceMin=<none>; ExpectedSequenceMax=<none>", *nonce, sequence))
}

Expand Down

0 comments on commit 3615aa3

Please sign in to comment.