improve ipv6 error handling

This commit is contained in:
Luke Pulverenti
2016-12-07 15:02:34 -05:00
parent 20c2499797
commit 0130209cdc
6 changed files with 80 additions and 26 deletions

View File

@@ -46,21 +46,11 @@ namespace Emby.Common.Implementations.Net
socket.DualMode = true;
}
return new NetSocket(socket, _logger);
return new NetSocket(socket, _logger, dualMode);
}
catch (SocketException ex)
{
if (dualMode)
{
_logger.Error("Error creating dual mode socket: {0}. Will retry with ipv4-only.", ex.SocketErrorCode);
if (ex.SocketErrorCode == SocketError.AddressFamilyNotSupported)
{
return CreateSocket(IpAddressFamily.InterNetwork, socketType, protocolType, false);
}
}
throw;
throw new SocketCreateException(ex.SocketErrorCode.ToString(), ex);
}
}