Commit e8934d97 authored by Marc Gravell's avatar Marc Gravell

tweak order of family/protocol discovery in CreateSocket, so we use consistent values

parent dbfce332
...@@ -124,12 +124,13 @@ private void Dispose(bool disposing) ...@@ -124,12 +124,13 @@ private void Dispose(bool disposing)
internal static Socket CreateSocket(EndPoint endpoint) internal static Socket CreateSocket(EndPoint endpoint)
{ {
var protocolType = endpoint.AddressFamily == AddressFamily.Unix ? ProtocolType.Unspecified : ProtocolType.Tcp;
var addressFamily = endpoint.AddressFamily; var addressFamily = endpoint.AddressFamily;
if (addressFamily == AddressFamily.Unspecified && endpoint is DnsEndPoint) if (addressFamily == AddressFamily.Unspecified && endpoint is DnsEndPoint)
{ // default DNS to ipv4 if not specified explicitly { // default DNS to ipv4 if not specified explicitly
addressFamily = AddressFamily.InterNetwork; addressFamily = AddressFamily.InterNetwork;
} }
var protocolType = addressFamily == AddressFamily.Unix ? ProtocolType.Unspecified : ProtocolType.Tcp;
var socket = new Socket(addressFamily, SocketType.Stream, protocolType); var socket = new Socket(addressFamily, SocketType.Stream, protocolType);
SocketConnection.SetRecommendedClientOptions(socket); SocketConnection.SetRecommendedClientOptions(socket);
return socket; return socket;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment