Fixed: crash when starting a new game after disconnecting from own server
This commit is contained in:
@@ -308,6 +308,9 @@ namespace OpenRA
|
|||||||
|
|
||||||
public static void Disconnect()
|
public static void Disconnect()
|
||||||
{
|
{
|
||||||
|
if (IsHost)
|
||||||
|
Server.Server.StopListening();
|
||||||
|
|
||||||
orderManager.Dispose();
|
orderManager.Dispose();
|
||||||
var shellmap = modData.Manifest.ShellmapUid;
|
var shellmap = modData.Manifest.ShellmapUid;
|
||||||
JoinLocal();
|
JoinLocal();
|
||||||
|
|||||||
@@ -50,6 +50,18 @@ namespace OpenRA.Server
|
|||||||
static ModData ModData;
|
static ModData ModData;
|
||||||
static Map Map;
|
static Map Map;
|
||||||
|
|
||||||
|
public static void StopListening()
|
||||||
|
{
|
||||||
|
conns.Clear();
|
||||||
|
GameStarted = false;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
listener.Stop();
|
||||||
|
}catch(Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
public static void ServerMain(ModData modData, Settings settings, string map)
|
public static void ServerMain(ModData modData, Settings settings, string map)
|
||||||
{
|
{
|
||||||
Log.AddChannel("server", "server.log");
|
Log.AddChannel("server", "server.log");
|
||||||
@@ -98,7 +110,7 @@ namespace OpenRA.Server
|
|||||||
|
|
||||||
foreach( Socket s in checkRead )
|
foreach( Socket s in checkRead )
|
||||||
if( s == listener.Server ) AcceptConnection();
|
if( s == listener.Server ) AcceptConnection();
|
||||||
else conns.Single( c => c.socket == s ).ReadData();
|
else if (conns.Count > 0) conns.Single( c => c.socket == s ).ReadData();
|
||||||
|
|
||||||
if (Environment.TickCount - lastPing > MasterPingInterval * 1000)
|
if (Environment.TickCount - lastPing > MasterPingInterval * 1000)
|
||||||
PingMasterServer();
|
PingMasterServer();
|
||||||
|
|||||||
Reference in New Issue
Block a user