aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-06-08 04:12:22 +0100
committerJustin Clark-Casey (justincc)2012-06-08 04:12:22 +0100
commitf94b92df4646162c0a8f37dd3373c6c2a20c66e3 (patch)
tree9c9315ca21224dd8c15d43bd886bf7b056686504 /OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
parentIf logging a client out due to ack timeout, do this asynchronously rather tha... (diff)
downloadopensim-SC-f94b92df4646162c0a8f37dd3373c6c2a20c66e3.zip
opensim-SC-f94b92df4646162c0a8f37dd3373c6c2a20c66e3.tar.gz
opensim-SC-f94b92df4646162c0a8f37dd3373c6c2a20c66e3.tar.bz2
opensim-SC-f94b92df4646162c0a8f37dd3373c6c2a20c66e3.tar.xz
Instead of retrieving the known client again in LLUDPServer.RemoveClient(), check the IsLoggingOut flag instead.
This is slightly better thread-race wise
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs31
1 files changed, 10 insertions, 21 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index e1fccb5..7f86491 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -560,7 +560,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
560 { 560 {
561 m_log.Warn("[LLUDPSERVER]: Ack timeout, disconnecting " + udpClient.AgentID); 561 m_log.Warn("[LLUDPSERVER]: Ack timeout, disconnecting " + udpClient.AgentID);
562 StatsManager.SimExtraStats.AddAbnormalClientThreadTermination(); 562 StatsManager.SimExtraStats.AddAbnormalClientThreadTermination();
563 RemoveClient(udpClient); 563 RemoveClient(client);
564 564
565 return; 565 return;
566 } 566 }
@@ -1110,26 +1110,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1110 return client; 1110 return client;
1111 } 1111 }
1112 1112
1113 private void RemoveClient(LLUDPClient udpClient) 1113 private void RemoveClient(IClientAPI client)
1114 { 1114 {
1115 // Remove this client from the scene 1115 // We must set IsLoggingOut synchronously so that we can stop the packet loop reinvoking this method.
1116 IClientAPI client; 1116 client.IsLoggingOut = true;
1117 if (m_scene.TryGetClient(udpClient.AgentID, out client))
1118 {
1119 // We must set IsLoggingOut synchronously so that we can stop the packet loop reinvoking this method.
1120 client.IsLoggingOut = true;
1121 1117
1122 // Fire this out on a different thread so that we don't hold up outgoing packet processing for 1118 // Fire this out on a different thread so that we don't hold up outgoing packet processing for
1123 // everybody else if this is being called due to an ack timeout. 1119 // everybody else if this is being called due to an ack timeout.
1124 // This is the same as processing as the async process of a logout request. 1120 // This is the same as processing as the async process of a logout request.
1125 Util.FireAndForget(o => client.Close()); 1121 Util.FireAndForget(o => client.Close());
1126 }
1127 else
1128 {
1129 m_log.WarnFormat(
1130 "[LLUDPSERVER]: Tried to remove client with id {0} but not such client in {1}",
1131 udpClient.AgentID, m_scene.RegionInfo.RegionName);
1132 }
1133 } 1122 }
1134 1123
1135 private void IncomingPacketHandler() 1124 private void IncomingPacketHandler()
@@ -1443,8 +1432,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1443 protected void LogoutHandler(IClientAPI client) 1432 protected void LogoutHandler(IClientAPI client)
1444 { 1433 {
1445 client.SendLogoutPacket(); 1434 client.SendLogoutPacket();
1446 if (client.IsActive) 1435 if (!client.IsLoggingOut)
1447 RemoveClient(((LLClientView)client).UDPClient); 1436 RemoveClient(client);
1448 } 1437 }
1449 } 1438 }
1450} \ No newline at end of file 1439} \ No newline at end of file