diff options
author | Justin Clark-Casey (justincc) | 2012-06-08 01:43:58 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-06-08 01:43:58 +0100 |
commit | d71c6dea7e5bfe827a9d723d972a9eec4cb77826 (patch) | |
tree | ea4bd2fb57b4f319b9bb117bc88c2e4bab66d7de /OpenSim/Region/ClientStack/Linden/UDP | |
parent | Don't make duplicate call to ScenePresence.Close() separately in ETM.DoTelepo... (diff) | |
download | opensim-SC-d71c6dea7e5bfe827a9d723d972a9eec4cb77826.zip opensim-SC-d71c6dea7e5bfe827a9d723d972a9eec4cb77826.tar.gz opensim-SC-d71c6dea7e5bfe827a9d723d972a9eec4cb77826.tar.bz2 opensim-SC-d71c6dea7e5bfe827a9d723d972a9eec4cb77826.tar.xz |
Store already retrieve IClientAPI in IncomingPacket structure for later use rather than doing another retrieve on dequeue.
Instead of checking whether the client still exists by trying to retrieve again from the client manager, this patch gets it back from IncomingPacket and checks the IClientAPI.IsActive state.
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/IncomingPacket.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 26 |
2 files changed, 16 insertions, 15 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/IncomingPacket.cs b/OpenSim/Region/ClientStack/Linden/UDP/IncomingPacket.cs index 90b3ede..1b8535c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/IncomingPacket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/IncomingPacket.cs | |||
@@ -39,7 +39,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
39 | public sealed class IncomingPacket | 39 | public sealed class IncomingPacket |
40 | { | 40 | { |
41 | /// <summary>Client this packet came from</summary> | 41 | /// <summary>Client this packet came from</summary> |
42 | public LLUDPClient Client; | 42 | public LLClientView Client; |
43 | |||
43 | /// <summary>Packet data that has been received</summary> | 44 | /// <summary>Packet data that has been received</summary> |
44 | public Packet Packet; | 45 | public Packet Packet; |
45 | 46 | ||
@@ -48,7 +49,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
48 | /// </summary> | 49 | /// </summary> |
49 | /// <param name="client">Reference to the client this packet came from</param> | 50 | /// <param name="client">Reference to the client this packet came from</param> |
50 | /// <param name="packet">Packet data</param> | 51 | /// <param name="packet">Packet data</param> |
51 | public IncomingPacket(LLUDPClient client, Packet packet) | 52 | public IncomingPacket(LLClientView client, Packet packet) |
52 | { | 53 | { |
53 | Client = client; | 54 | Client = client; |
54 | Packet = packet; | 55 | Packet = packet; |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 09bb52c..55bda63 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -879,7 +879,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
879 | #endregion Ping Check Handling | 879 | #endregion Ping Check Handling |
880 | 880 | ||
881 | // Inbox insertion | 881 | // Inbox insertion |
882 | packetInbox.Enqueue(new IncomingPacket(udpClient, packet)); | 882 | packetInbox.Enqueue(new IncomingPacket((LLClientView)client, packet)); |
883 | } | 883 | } |
884 | 884 | ||
885 | #region BinaryStats | 885 | #region BinaryStats |
@@ -1386,22 +1386,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1386 | 1386 | ||
1387 | #endregion | 1387 | #endregion |
1388 | 1388 | ||
1389 | private void ProcessInPacket(object state) | 1389 | private void ProcessInPacket(IncomingPacket incomingPacket) |
1390 | { | 1390 | { |
1391 | IncomingPacket incomingPacket = (IncomingPacket)state; | ||
1392 | Packet packet = incomingPacket.Packet; | 1391 | Packet packet = incomingPacket.Packet; |
1393 | LLUDPClient udpClient = incomingPacket.Client; | 1392 | LLClientView client = incomingPacket.Client; |
1394 | IClientAPI client; | ||
1395 | 1393 | ||
1396 | // Sanity check | 1394 | // Sanity check |
1397 | if (packet == null || udpClient == null) | 1395 | if (packet == null || client == null) |
1398 | { | 1396 | { |
1399 | m_log.WarnFormat("[LLUDPSERVER]: Processing a packet with incomplete state. Packet=\"{0}\", UDPClient=\"{1}\"", | 1397 | m_log.WarnFormat("[LLUDPSERVER]: Processing a packet with incomplete state. Packet=\"{0}\", Client=\"{1}\"", |
1400 | packet, udpClient); | 1398 | packet, client); |
1401 | } | 1399 | } |
1402 | 1400 | ||
1403 | // Make sure this client is still alive | 1401 | if (client.IsActive) |
1404 | if (m_scene.TryGetClient(udpClient.AgentID, out client)) | ||
1405 | { | 1402 | { |
1406 | m_currentIncomingClient = client; | 1403 | m_currentIncomingClient = client; |
1407 | 1404 | ||
@@ -1419,8 +1416,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1419 | catch (Exception e) | 1416 | catch (Exception e) |
1420 | { | 1417 | { |
1421 | // Don't let a failure in an individual client thread crash the whole sim. | 1418 | // Don't let a failure in an individual client thread crash the whole sim. |
1422 | m_log.ErrorFormat("[LLUDPSERVER]: Client packet handler for {0} for packet {1} threw an exception", udpClient.AgentID, packet.Type); | 1419 | m_log.Error( |
1423 | m_log.Error(e.Message, e); | 1420 | string.Format( |
1421 | "[LLUDPSERVER]: Client packet handler for {0} for packet {1} threw ", | ||
1422 | client.Name, packet.Type), | ||
1423 | e); | ||
1424 | } | 1424 | } |
1425 | finally | 1425 | finally |
1426 | { | 1426 | { |
@@ -1431,7 +1431,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1431 | { | 1431 | { |
1432 | m_log.DebugFormat( | 1432 | m_log.DebugFormat( |
1433 | "[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}", | 1433 | "[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}", |
1434 | packet.Type, udpClient.AgentID, m_scene.RegionInfo.RegionName); | 1434 | packet.Type, client.Name, m_scene.RegionInfo.RegionName); |
1435 | } | 1435 | } |
1436 | } | 1436 | } |
1437 | 1437 | ||