Skip to content

Commit

Permalink
fix DNS query for IPv6
Browse files Browse the repository at this point in the history
  • Loading branch information
breakwa11 committed Jun 25, 2017
1 parent 0f3cd87 commit 594c525
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions shadowsocks-csharp/Util/Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -411,12 +411,13 @@ public static IPAddress QueryDns(string host, string dns_servers, bool IPv6_firs
IAsyncResult result = callback.BeginInvoke(host, null, null);
if (result.AsyncWaitHandle.WaitOne(10000, true))
{
foreach (IPAddress ad in callback.EndInvoke(result).AddressList)
IPHostEntry ipHostEntry = callback.EndInvoke(result);
foreach (IPAddress ad in ipHostEntry.AddressList)
{
if (ad.AddressFamily == AddressFamily.InterNetwork)
return ad;
}
foreach (IPAddress ad in callback.EndInvoke(result).AddressList)
foreach (IPAddress ad in ipHostEntry.AddressList)
{
return ad;
}
Expand Down

0 comments on commit 594c525

Please sign in to comment.