diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 2b827412980e5292b5ecd3db459292af8ed0c734..963496aab5b49eddfb4779dda2ef1f7e9d14674b 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
if NetUseMaster then
begin
if NetUseMaster then
begin
- if gTime >= NetTimeToMaster then
+ if (gTime >= NetTimeToMaster) or g_Net_Slist_IsConnectionInProgress then
begin
begin
- if (NetMHost = nil) or (NetMPeer = nil) then
- begin
- g_Net_Slist_Connect(false); // non-blocking connection to the master
- end;
-
+ if (not g_Net_Slist_IsConnectionActive) then g_Net_Slist_Connect(false); // non-blocking connection to the master
g_Net_Slist_Update;
NetTimeToMaster := gTime + NetMasterRate;
end;
g_Net_Slist_Update;
NetTimeToMaster := gTime + NetMasterRate;
end;
// Ìàñòåðñåðâåð
if NetUseMaster then
begin
// Ìàñòåðñåðâåð
if NetUseMaster then
begin
- if (NetMHost = nil) or (NetMPeer = nil) then
- begin
- // let the connection be blocking here, why not?
- g_Net_Slist_Connect();
- end;
+ if (not g_Net_Slist_IsConnectionActive) then g_Net_Slist_Connect(false); // non-blocking connection to the master
g_Net_Slist_Update;
end;
g_Net_Slist_Update;
end;
begin
NetUseMaster := StrToIntDef(P[1], Byte(NetUseMaster)) > 0;
if g_Game_IsServer and g_Game_IsNet then
begin
NetUseMaster := StrToIntDef(P[1], Byte(NetUseMaster)) > 0;
if g_Game_IsServer and g_Game_IsNet then
+ begin
if NetUseMaster then
begin
if NetUseMaster then
begin
- if NetMPeer = nil then g_Net_Slist_Connect();
+ if (not g_Net_Slist_IsConnectionActive) then g_Net_Slist_Connect(false); // non-blocking connection to the master
g_Net_Slist_Update();
end
else
g_Net_Slist_Update();
end
else
- if NetMPeer <> nil then
- g_Net_Slist_Disconnect();
+ begin
+ if (not g_Net_Slist_IsConnectionActive) then g_Net_Slist_Disconnect();
+ end;
+ end;
end;
g_Console_Add(cmd + ' = ' + IntToStr(Byte(NetUseMaster)));
end;
g_Console_Add(cmd + ' = ' + IntToStr(Byte(NetUseMaster)));