Disconnect every client on shutdown. Changed default value for AnnounceSelf

This commit is contained in:
EntenKoeniq
2021-12-08 14:46:07 +01:00
parent 6a57f0c797
commit 4170001edf
3 changed files with 10 additions and 2 deletions

View File

@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<AssemblyVersion>1.4.1.0001</AssemblyVersion> <AssemblyVersion>1.4.2.0001</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion> <FileVersion>1.0.0.0</FileVersion>
<RepositoryUrl>https://github.com/GTACOOP-R/GTACoop-R</RepositoryUrl> <RepositoryUrl>https://github.com/GTACOOP-R/GTACoop-R</RepositoryUrl>
</PropertyGroup> </PropertyGroup>

View File

@ -443,6 +443,14 @@ namespace CoopServer
Thread.Sleep(1000 / 60); Thread.Sleep(1000 / 60);
} }
} }
if (MainNetServer.Connections.Count > 0)
{
MainNetServer.Connections.ForEach(x => x.Disconnect("Server is shutting down!"));
// We have to wait some time for all Disconnect() messages to be sent successfully
// Sleep for 1 second
Thread.Sleep(1000);
}
} }
#region -- PLAYER -- #region -- PLAYER --

View File

@ -11,7 +11,7 @@
public bool NpcsAllowed { get; set; } = true; public bool NpcsAllowed { get; set; } = true;
public bool ModsAllowed { get; set; } = false; public bool ModsAllowed { get; set; } = false;
public bool UPnP { get; set; } = true; public bool UPnP { get; set; } = true;
public bool AnnounceSelf { get; set; } = true; public bool AnnounceSelf { get; set; } = false;
public string MasterServer { get; set; } = "http://gtacoopr.000webhostapp.com/servers.php"; public string MasterServer { get; set; } = "http://gtacoopr.000webhostapp.com/servers.php";
public bool DebugMode { get; set; } = false; public bool DebugMode { get; set; } = false;
} }