Skip to content

Commit

Permalink
Set hostname to localhost if DNS fails
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieSinn committed Jun 24, 2024
1 parent d5e6f66 commit 18f5e8e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
15 changes: 14 additions & 1 deletion DevCycle.SDK.Server.Common/Model/Local/PlatformData.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Net;
using System.Net.Sockets;
using Newtonsoft.Json;

namespace DevCycle.SDK.Server.Common.Model.Local
Expand Down Expand Up @@ -62,7 +63,19 @@ public PlatformData()
PlatformVersion = DefaultPlatformVersion;
SdkType = DefaultSdkType.ToString().ToLower();
SdkVersion = DefaultSdkVersion;
HostName = Dns.GetHostName();
try
{
HostName = Dns.GetHostName();

}
catch (SocketException)
{
}
if (HostName == "")
{
HostName = "localhost";
}

}
}
}
1 change: 0 additions & 1 deletion DevCycle.SDK.Server.Local/Api/LocalBucketing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public class LocalBucketing

private static readonly SemaphoreSlim WasmMutex = new(1, 1);
private static readonly SemaphoreSlim FlushMutex = new(1, 1);
private static string _clientUuid;
private Func<string, string> handleError;

private Dictionary<string, int> sdkKeyAddresses;
Expand Down

0 comments on commit 18f5e8e

Please sign in to comment.