Dedupe Hello sends; retry on reject

This commit is contained in:
RallyBlock committed 2026-11-09 15:05:54 -05:00
1 parent cb4ddfdee6
commit 80c4a64e76
1 file changed
+18 -2
+18 -2
View File
@@ -6,6 +6,8 @@ $RPGClient::Version = 2;
$RPGClient::Active = 0;
$RPGClient::Yaw = 0;
$RPGClient::Dist = 14;
$RPGClient::HelloPending = 0;
$RPGClient::HelloLast = "";
function RPGClient_NormPos(%ctrl, %pos)
{
@@ -204,10 +206,20 @@ function RPGClient_ZoomOut(%val)
function RPGClient_SendHello()
{
if ($RPGClient::Server)
{
return;
}
if (!isObject(ServerConnection))
{
return;
}
%now = getSimTime();
if ($RPGClient::HelloLast !$= "" && %now - $RPGClient::HelloLast < 900)
{
return;
}
$RPGClient::HelloLast = %now;
commandToServer('RPG_Hello', $RPGClient::Version);
}
@@ -221,10 +233,12 @@ function clientCmdRPG_Welcome(%serverProto, %accepted)
if (%accepted && %serverProto == $RPGClient::Version)
{
$RPGClient::Server = 1;
$RPGClient::HelloPending = 0;
}
else if (!%accepted)
{
echo("Client_RPG: server rejected handshake (server proto " @ %serverProto @ ")");
schedule(1500, 0, RPGClient_SendHello);
}
}
@@ -367,6 +381,9 @@ package RPGClient_Cleanup
{
RPGClient_DisableOverlay();
RPGClient_UnbindKeys();
$RPGClient::Server = 0;
$RPGClient::HelloPending = 0;
$RPGClient::HelloLast = "";
Parent::disconnectedCleanup(%doReconnect);
}
};
@@ -377,8 +394,7 @@ package RPGClient_Mission
function onMissionDownloadComplete()
{
Parent::onMissionDownloadComplete();
schedule(200, 0, RPGClient_SendHello);
schedule(2000, 0, RPGClient_SendHello);
schedule(250, 0, RPGClient_SendHello);
}
};
activatePackage(RPGClient_Mission);