Skip to content

Commit 800452e

Browse files
committed
Capture inner SocketException from IOException.
1 parent e510a8c commit 800452e

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Serilog.Sinks.Network/Sinks/TCP/TCPSocketWriter.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,20 @@ public async Task<Stream> ConnectAsync(Func<Uri, Task<Stream>> connect, Uri host
240240
{
241241
try
242242
{
243-
Log.Debug("Attempting to connect to TCP endpoint {host} after delay of {delay} seconds", host, delay);
243+
Log.Debug("Attempting to connect to TCP endpoint {host} after delay of {delay} seconds", host,
244+
delay);
244245
return await connect(host);
245246
}
246-
catch (SocketException) { }
247+
catch (SocketException)
248+
{
249+
}
250+
catch (IOException e)
251+
{
252+
if (e.InnerException is SocketException)
253+
{
254+
throw;
255+
}
256+
}
247257

248258
// If this is cancelled via the cancellationToken instead of
249259
// completing its delay, the next while-loop test will fail,

0 commit comments

Comments
 (0)