1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Add simple healthcheck

This commit is contained in:
nordsoft
2022-09-22 05:06:49 +04:00
parent faccad7a15
commit 667d97d300

View File

@@ -161,6 +161,18 @@ void CServerHandler::startLocalServerAndConnect()
threadRunLocalServer->join(); threadRunLocalServer->join();
th->update(); th->update();
try
{
CConnection testConnection(settings["server"]["server"].String(), getDefaultPort(), NAME, uuid);
logNetwork->error("Port is busy, kill other vcmiserver processes");
return;
}
catch(...)
{
//no connection means that port is not busy and we can start local server
}
#ifdef VCMI_ANDROID #ifdef VCMI_ANDROID
{ {
CAndroidVMHelper envHelper; CAndroidVMHelper envHelper;