Skip to content

Commit 33693df

Browse files
author
Vlad Ionescu
committed
unwrapping the IOException only for SocketException with error code WSAETIMEDOUT
1 parent 1a1e3ab commit 33693df

File tree

1 file changed

+7
-2
lines changed
  • projects/client/RabbitMQ.Client/src/client/impl

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
//---------------------------------------------------------------------------
5757
using System;
5858
using System.IO;
59+
using System.Net.Sockets;
5960

6061
using RabbitMQ.Util;
6162
using RabbitMQ.Client.Exceptions;
@@ -109,8 +110,12 @@ public static Frame ReadFrom(NetworkBinaryReader reader)
109110
}
110111
catch (IOException ioe)
111112
{
112-
if (ioe.InnerException != null)
113-
throw ioe.InnerException;
113+
// If it's a WSAETIMEDOUT SocketException, unwrap it.
114+
// This might happen when the limit of half-open connections is
115+
// reached.
116+
SocketException se = (SocketException) ioe.InnerException;
117+
if (se != null && se.SocketErrorCode == SocketError.TimedOut)
118+
throw se;
114119
else
115120
throw;
116121
}

0 commit comments

Comments
 (0)