mirror of
https://github.com/Stone-Red-Code/HyperbolicDownloader.git
synced 2026-09-04 09:06:10 +02:00
Fix StartTcpListener method not stopping program if fails
This commit is contained in:
@@ -52,7 +52,10 @@ internal static class Program
|
|||||||
ConsoleExt.WriteLine($"The private port is: {ApiConfiguration.PrivatePort}", ConsoleColor.Green);
|
ConsoleExt.WriteLine($"The private port is: {ApiConfiguration.PrivatePort}", ConsoleColor.Green);
|
||||||
|
|
||||||
Console.WriteLine("Starting TCP listener...");
|
Console.WriteLine("Starting TCP listener...");
|
||||||
apiManager.StartTcpListener();
|
if (!apiManager.StartTcpListener())
|
||||||
|
{
|
||||||
|
Console.ReadLine();
|
||||||
|
}
|
||||||
|
|
||||||
Console.WriteLine("Starting broadcast listener...");
|
Console.WriteLine("Starting broadcast listener...");
|
||||||
apiManager.StartBroadcastListener();
|
apiManager.StartBroadcastListener();
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ public class ApiManager
|
|||||||
broadcastClient.OnBroadcastRecived += BroadcastClient_OnBroadcastRecived;
|
broadcastClient.OnBroadcastRecived += BroadcastClient_OnBroadcastRecived;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartTcpListener()
|
public bool StartTcpListener()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -128,8 +128,10 @@ public class ApiManager
|
|||||||
catch (SocketException ex)
|
catch (SocketException ex)
|
||||||
{
|
{
|
||||||
SendNotificationMessageNewLine($"An error occurred while starting the TCP listener! Error message: {ex.Message}", NotificationMessageType.Error); // net stop hens && net start hns
|
SendNotificationMessageNewLine($"An error occurred while starting the TCP listener! Error message: {ex.Message}", NotificationMessageType.Error); // net stop hens && net start hns
|
||||||
Console.ReadKey();
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void BroadcastClient_OnBroadcastRecived(object? sender, BroadcastRecivedEventArgs recivedEventArgs)
|
private async void BroadcastClient_OnBroadcastRecived(object? sender, BroadcastRecivedEventArgs recivedEventArgs)
|
||||||
|
|||||||
Reference in New Issue
Block a user