diff --git a/Libraries/SPTarkov.Server.Core/Helpers/HttpServerHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/HttpServerHelper.cs
index ad844256..ceabd17a 100644
--- a/Libraries/SPTarkov.Server.Core/Helpers/HttpServerHelper.cs
+++ b/Libraries/SPTarkov.Server.Core/Helpers/HttpServerHelper.cs
@@ -1,4 +1,6 @@
-using SPTarkov.DI.Annotations;
+using System.Net;
+using System.Net.Sockets;
+using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.Models.Spt.Config;
using SPTarkov.Server.Core.Servers;
@@ -58,22 +60,24 @@ public class HttpServerHelper(ConfigServer configServer)
/// Method to determine if another version of the server is already running
///
/// bool isAlreadyRunning
- public async Task IsAlreadyRunning()
+ public bool IsAlreadyRunning()
{
+ TcpListener? listener = null;
+
try
{
- var handler = new HttpClientHandler()
- {
- ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
- };
- var http = new HttpClient(handler);
- var res = await http.PostAsync($"{GetBackendUrl()}/launcher/ping", null);
- return res.IsSuccessStatusCode;
- }
- catch (Exception )
- {
+ listener = new(IPAddress.Parse(_httpConfig.Ip), _httpConfig.Port);
+ listener.Start();
return false;
}
+ catch (Exception)
+ {
+ return true;
+ }
+ finally
+ {
+ listener?.Stop();
+ }
}
public void SendTextJson(HttpResponse resp, object output)
diff --git a/Libraries/SPTarkov.Server.Core/Utils/App.cs b/Libraries/SPTarkov.Server.Core/Utils/App.cs
index f20e56cd..c0686642 100644
--- a/Libraries/SPTarkov.Server.Core/Utils/App.cs
+++ b/Libraries/SPTarkov.Server.Core/Utils/App.cs
@@ -62,7 +62,7 @@ public class App
// execute onLoad callbacks
_logger.Info(_localisationService.GetText("executing_startup_callbacks"));
- var isAlreadyRunning = await _httpServerHelper.IsAlreadyRunning();
+ var isAlreadyRunning = _httpServerHelper.IsAlreadyRunning();
if (isAlreadyRunning)
{
_logger.Critical(_localisationService.GetText("webserver_already_running"));