Skip to content

Commit c823046

Browse files
Catch SocketException in SocketFrameHandler#Timeout
While out of scope of this bug, I need this to make the tests pass on one of my machines. Plus we renamed SocketFrameHandler on this branch, so changing this in default will require extra effort later.
1 parent 00ac75e commit c823046

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

projects/client/RabbitMQ.Client/src/client/impl/SocketFrameHandler.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,19 @@ public int Timeout
144144
{
145145
set
146146
{
147-
if (m_socket.Connected)
147+
try
148+
{
149+
if (m_socket.Connected)
150+
{
151+
m_socket.ReceiveTimeout = value;
152+
}
153+
}
154+
#pragma warning disable 0168
155+
catch (SocketException _)
148156
{
149-
m_socket.ReceiveTimeout = value;
157+
// means that the socket is already closed
150158
}
159+
#pragma warning restore 0168
151160
}
152161
}
153162

0 commit comments

Comments
 (0)