summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8de2973)
raw | patch | inline | side by side (parent: 8de2973)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Fri, 18 Oct 2019 03:17:45 +0000 (06:17 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Fri, 18 Oct 2019 03:19:08 +0000 (06:19 +0300) |
src/game/g_netmaster.pas | patch | blob | history |
index 1703da27cdcbe44c21bf4f0b6bbc9875c97af211..67747595d085f70169932a4cc1c984982c3fbbb3 100644 (file)
--- a/src/game/g_netmaster.pas
+++ b/src/game/g_netmaster.pas
slReadUrgent: Boolean;
// temporary mark
justAdded: Boolean;
+ connectCount: Integer;
private
netmsg: TMsg;
slMOTD := '';
slUrgent := '';
slReadUrgent := true;
+ justAdded := false;
+ connectCount := 0;
netmsg.Alloc(NET_BUFSIZE);
setAddress(ea, '');
end;
NetUpdatePending := false;
updateSent := false;
lastUpdateTime := 0;
+ Inc(connectCount);
peer := enet_host_connect(NetMHost, @enetAddr, NET_MCHANS, 0);
if (peer = nil) then
if (not mlist[f].isAlive()) then
begin
// not connected; try to reconnect if we're asking for a host list, or we are in netgame, and we are the host
- if isListQuery or isMasterReportsEnabled() then
+ if (not isListQuery) and isMasterReportsEnabled() then
begin
if (mlist[f].lastDisconnectTime = 0) or (ct < mlist[f].lastDisconnectTime) or (ct-mlist[f].lastDisconnectTime >= 1000*NMASTER_TIMEOUT_RECONNECT) then
begin
DisconnectAll(true); // forced disconnect
+ for f := 0 to High(mlist) do
+ begin
+ mlist[f].connectCount := 0;
+ mlist[f].srvAnswered := 0;
+ end;
+
NetOut.Clear();
NetOut.Write(Byte(NET_MMSG_GET));
if (not mlist[f].isValid()) then continue;
if (not mlist[f].isAlive()) then
begin
- mlist[f].connect();
- if (mlist[f].isAlive()) then
+ if (mlist[f].connectCount = 0) then
begin
- //g_Console_Add(Format(_lc[I_NET_MSG]+_lc[I_NET_SLIST_WCONN], [mlist[f].hostName]));
- hasUnanswered := true;
- stt := GetTimerMS();
+ mlist[f].connect();
+ if (mlist[f].isAlive()) then
+ begin
+ //g_Console_Add(Format(_lc[I_NET_MSG]+_lc[I_NET_SLIST_WCONN], [mlist[f].hostName]));
+ hasUnanswered := true;
+ stt := GetTimerMS();
+ end;
+ end
+ else if (mlist[f].srvAnswered > 1) then
+ begin
+ Inc(aliveCount);
end;
end
else if (mlist[f].isConnected()) then
else if (mlist[f].srvAnswered > 1) then
begin
Inc(aliveCount);
+ mlist[f].disconnect(false); // not forced
end;
end
else if (mlist[f].isConnecting()) then