If the simulator closes a root agent due to ack timeout, then send the client a kick message with that reason, in case it is somehow still listening.

0.7.3-extended
Justin Clark-Casey (justincc) 2012-06-12 02:03:31 +01:00
parent d8c40ca462
commit c3104f4bd2
1 changed files with 20 additions and 2 deletions

View File

@ -558,9 +558,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (!client.IsLoggingOut && if (!client.IsLoggingOut &&
(Environment.TickCount & Int32.MaxValue) - udpClient.TickLastPacketReceived > timeoutTicks) (Environment.TickCount & Int32.MaxValue) - udpClient.TickLastPacketReceived > timeoutTicks)
{ {
m_log.Warn("[LLUDPSERVER]: Ack timeout, disconnecting " + udpClient.AgentID); m_log.WarnFormat(
"[LLUDPSERVER]: Ack timeout for {0} {1}, disconnecting",
client.Name, client.AgentId);
StatsManager.SimExtraStats.AddAbnormalClientThreadTermination(); StatsManager.SimExtraStats.AddAbnormalClientThreadTermination();
RemoveClient(client); LogoutClientDueToTimeout(client);
return; return;
} }
@ -1121,6 +1124,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
Util.FireAndForget(o => client.Close()); Util.FireAndForget(o => client.Close());
} }
private void LogoutClientDueToTimeout(IClientAPI client)
{
// We must set IsLoggingOut synchronously so that we can stop the packet loop reinvoking this method.
client.IsLoggingOut = true;
// Fire this out on a different thread so that we don't hold up outgoing packet processing for
// everybody else if this is being called due to an ack timeout.
// This is the same as processing as the async process of a logout request.
Util.FireAndForget(
o =>
{ if (!client.SceneAgent.IsChildAgent)
client.Kick("Simulator logged you out due to connection timeout");
client.Close(); });
}
private void IncomingPacketHandler() private void IncomingPacketHandler()
{ {
// Set this culture for the thread that incoming packets are received // Set this culture for the thread that incoming packets are received