Skip to content

Commit

Permalink
fix socket exhaustion, change address to interpolated strings
Browse files Browse the repository at this point in the history
  • Loading branch information
BitesizedLion committed Dec 18, 2022
1 parent 92bfd16 commit b4a1267
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 13 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 0 additions & 2 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ static void Main()
client.Dispose();
}



static async Task StartWebServer()
{
var listener = new HttpListener();
Expand Down
8 changes: 4 additions & 4 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
[assembly: AssemblyTitle("TidalRPC")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCompany("BitesizedLion")]
[assembly: AssemblyProduct("TidalRPC")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyCopyright("Copyright © BitesizedLion 2022-")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.1.1")]
[assembly: AssemblyFileVersion("1.0.1.1")]
11 changes: 6 additions & 5 deletions UpdateManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,17 @@ public static void ToggleUpdateCheck(bool checkForUpdates)
// Method for checking for new updates
public static async Task CheckForUpdates()
{
// Get the current application version
Version currentVersion = Assembly.GetExecutingAssembly().GetName().Version;

HttpClient client = new HttpClient();
client.DefaultRequestHeaders.UserAgent.ParseAdd("tidalrpc/" + currentVersion.ToString()); // GH api needs custom user-agent

while (!updateDenied)
{
if (!IsUpdateCheckEnabled()) return;

// Get the current application version
Version currentVersion = Assembly.GetExecutingAssembly().GetName().Version;

// Fetch the latest release information from the GitHub API
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.UserAgent.ParseAdd("tidalrpc/" + currentVersion.ToString()); // GH api needs custom user-agent
HttpResponseMessage response = await client.GetAsync("https://api.github.com/repos/BitesizedLion/TidalRPC/releases/latest");

if (response.IsSuccessStatusCode)
Expand Down
4 changes: 2 additions & 2 deletions Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ public static string GetAddress()
if (!File.Exists(filePath))
{
Console.WriteLine("GetAddress: coreProps does not exist, returning default address");
return "http://127.0.0.1:3650";
return "http://127.0.0.1:3650/";
}

string jsonString = File.ReadAllText(filePath);
dynamic json = JsonConvert.DeserializeObject(jsonString);
string address = "http://"+json.address+"/";
string address = $"http://{json["address"]}/";

return address;
}
Expand Down

0 comments on commit b4a1267

Please sign in to comment.