Skip to content

Commit c75f4d5

Browse files
authored
Guard PipeReader.AdvanceTo on closed socket (#433)
Problem: A race during shutdown could call reader.AdvanceTo(buffer.Start, buffer.End) after the TCP socket is closed, risking exceptions that propagate via reader.CompleteAsync(caught) and noisy logs. Change: In Connection.ProcessIncomingFrames, only call reader.AdvanceTo(...) when socket.Connected is true.
1 parent 5361f04 commit c75f4d5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

RabbitMQ.Stream.Client/Connection.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,10 @@ private async Task ProcessIncomingFrames()
189189
numFrames += 1;
190190
}
191191

192-
reader.AdvanceTo(buffer.Start, buffer.End);
192+
if (socket.Connected)
193+
{
194+
reader.AdvanceTo(buffer.Start, buffer.End);
195+
}
193196
}
194197
}
195198
catch (OperationCanceledException e)

0 commit comments

Comments
 (0)