#4570 Attemp to send logout message when lost network

To not leave a ghost behind and for faster reconnect
master
Andrey Kleshchev 2025-08-21 01:27:08 +03:00 committed by Andrey Kleshchev
parent d5f748c91c
commit f5423d4517
2 changed files with 26 additions and 0 deletions

View File

@ -4530,6 +4530,7 @@ void LLAppViewer::forceDisconnect(const std::string& mesg)
}
else
{
sendSimpleLogoutRequest();
args["MESSAGE"] = big_reason;
LLNotificationsUtil::add("YouHaveBeenLoggedOut", args, LLSD(), &finish_disconnect );
}
@ -5310,6 +5311,27 @@ void LLAppViewer::sendLogoutRequest()
}
}
void LLAppViewer::sendSimpleLogoutRequest()
{
if (!mLogoutRequestSent && gMessageSystem)
{
gLogoutInProgress = true;
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_LogoutRequest);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
gAgent.sendReliableMessage();
LL_INFOS("Agent") << "Logging out as agent: " << gAgent.getID() << " Session: " << gAgent.getSessionID() << LL_ENDL;
gLogoutTimer.reset();
gLogoutMaxTime = LOGOUT_REQUEST_TIME;
mLogoutRequestSent = true;
}
}
void LLAppViewer::updateNameLookupUrl(const LLViewerRegion * regionp)
{
if (!regionp || !regionp->capabilitiesReceived())

View File

@ -310,6 +310,10 @@ private:
void sendLogoutRequest();
void disconnectViewer();
// Does not create a marker file. For lost network case,
// to at least attempt to remove the ghost from the world.
void sendSimpleLogoutRequest();
// *FIX: the app viewer class should be some sort of singleton, no?
// Perhaps its child class is the singleton and this should be an abstract base.
static LLAppViewer* sInstance;