aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-10-17 23:08:14 +0100
committerJustin Clark-Casey (justincc)2012-10-17 23:08:14 +0100
commitfaf6b568393d8edfed103e0a656c98322c195e95 (patch)
treea85ae4d98d4c48b68591420ec43af156293106b9 /OpenSim/Region/ClientStack/Linden
parentIf RecycleBaseUDPPackets = true, also pool IncomingPackets to reduce memory c... (diff)
downloadopensim-SC_OLD-faf6b568393d8edfed103e0a656c98322c195e95.zip
opensim-SC_OLD-faf6b568393d8edfed103e0a656c98322c195e95.tar.gz
opensim-SC_OLD-faf6b568393d8edfed103e0a656c98322c195e95.tar.bz2
opensim-SC_OLD-faf6b568393d8edfed103e0a656c98322c195e95.tar.xz
Explicitly return only the incoming AgentUpdate packet as this is the only one we pool atm, rather than attempting to return all incoming packets.
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs11
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs17
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs10
3 files changed, 30 insertions, 8 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 0d4f09d..1e93b84 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -5425,16 +5425,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5425 5425
5426 #region Scene/Avatar 5426 #region Scene/Avatar
5427 5427
5428 private bool HandleAgentUpdate(IClientAPI sener, Packet Pack) 5428 private bool HandleAgentUpdate(IClientAPI sener, Packet packet)
5429 { 5429 {
5430 if (OnAgentUpdate != null) 5430 if (OnAgentUpdate != null)
5431 { 5431 {
5432 bool update = false; 5432 bool update = false;
5433 AgentUpdatePacket agenUpdate = (AgentUpdatePacket)Pack; 5433 AgentUpdatePacket agenUpdate = (AgentUpdatePacket)packet;
5434 5434
5435 #region Packet Session and User Check 5435 #region Packet Session and User Check
5436 if (agenUpdate.AgentData.SessionID != SessionId || agenUpdate.AgentData.AgentID != AgentId) 5436 if (agenUpdate.AgentData.SessionID != SessionId || agenUpdate.AgentData.AgentID != AgentId)
5437 {
5438 PacketPool.Instance.ReturnPacket(packet);
5437 return false; 5439 return false;
5440 }
5438 #endregion 5441 #endregion
5439 5442
5440 AgentUpdatePacket.AgentDataBlock x = agenUpdate.AgentData; 5443 AgentUpdatePacket.AgentDataBlock x = agenUpdate.AgentData;
@@ -5499,6 +5502,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5499 } 5502 }
5500 } 5503 }
5501 5504
5505 PacketPool.Instance.ReturnPacket(packet);
5506
5502 return true; 5507 return true;
5503 } 5508 }
5504 5509
@@ -11851,8 +11856,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11851 11856
11852 if (!ProcessPacketMethod(packet)) 11857 if (!ProcessPacketMethod(packet))
11853 m_log.Warn("[CLIENT]: unhandled packet " + packet.Type); 11858 m_log.Warn("[CLIENT]: unhandled packet " + packet.Type);
11854
11855 PacketPool.Instance.ReturnPacket(packet);
11856 } 11859 }
11857 11860
11858 private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket) 11861 private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket)
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 286d931..419de66 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -314,7 +314,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
314 314
315 base.StartOutbound(); 315 base.StartOutbound();
316 316
317 // This thread will process the packets received that are placed on the packetInbox
318 Watchdog.StartThread( 317 Watchdog.StartThread(
319 OutgoingPacketHandler, 318 OutgoingPacketHandler,
320 string.Format("Outgoing Packets ({0})", m_scene.RegionInfo.RegionName), 319 string.Format("Outgoing Packets ({0})", m_scene.RegionInfo.RegionName),
@@ -930,6 +929,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
930 // Handle appended ACKs 929 // Handle appended ACKs
931 if (packet.Header.AppendedAcks && packet.Header.AckList != null) 930 if (packet.Header.AppendedAcks && packet.Header.AckList != null)
932 { 931 {
932// m_log.DebugFormat(
933// "[LLUDPSERVER]: Handling {0} appended acks from {1} in {2}",
934// packet.Header.AckList.Length, client.Name, m_scene.Name);
935
933 for (int i = 0; i < packet.Header.AckList.Length; i++) 936 for (int i = 0; i < packet.Header.AckList.Length; i++)
934 udpClient.NeedAcks.Acknowledge(packet.Header.AckList[i], now, packet.Header.Resent); 937 udpClient.NeedAcks.Acknowledge(packet.Header.AckList[i], now, packet.Header.Resent);
935 } 938 }
@@ -939,6 +942,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
939 { 942 {
940 PacketAckPacket ackPacket = (PacketAckPacket)packet; 943 PacketAckPacket ackPacket = (PacketAckPacket)packet;
941 944
945// m_log.DebugFormat(
946// "[LLUDPSERVER]: Handling {0} packet acks for {1} in {2}",
947// ackPacket.Packets.Length, client.Name, m_scene.Name);
948
942 for (int i = 0; i < ackPacket.Packets.Length; i++) 949 for (int i = 0; i < ackPacket.Packets.Length; i++)
943 udpClient.NeedAcks.Acknowledge(ackPacket.Packets[i].ID, now, packet.Header.Resent); 950 udpClient.NeedAcks.Acknowledge(ackPacket.Packets[i].ID, now, packet.Header.Resent);
944 951
@@ -952,6 +959,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
952 959
953 if (packet.Header.Reliable) 960 if (packet.Header.Reliable)
954 { 961 {
962// m_log.DebugFormat(
963// "[LLUDPSERVER]: Adding ack request for {0} {1} from {2} in {3}",
964// packet.Type, packet.Header.Sequence, client.Name, m_scene.Name);
965
955 udpClient.PendingAcks.Enqueue(packet.Header.Sequence); 966 udpClient.PendingAcks.Enqueue(packet.Header.Sequence);
956 967
957 // This is a somewhat odd sequence of steps to pull the client.BytesSinceLastACK value out, 968 // This is a somewhat odd sequence of steps to pull the client.BytesSinceLastACK value out,
@@ -998,6 +1009,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
998 1009
999 if (packet.Type == PacketType.StartPingCheck) 1010 if (packet.Type == PacketType.StartPingCheck)
1000 { 1011 {
1012// m_log.DebugFormat("[LLUDPSERVER]: Handling ping from {0} in {1}", client.Name, m_scene.Name);
1013
1001 // We don't need to do anything else with ping checks 1014 // We don't need to do anything else with ping checks
1002 StartPingCheckPacket startPing = (StartPingCheckPacket)packet; 1015 StartPingCheckPacket startPing = (StartPingCheckPacket)packet;
1003 CompletePing(udpClient, startPing.PingID.PingID); 1016 CompletePing(udpClient, startPing.PingID.PingID);
@@ -1286,7 +1299,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1286 // on to en-US to avoid number parsing issues 1299 // on to en-US to avoid number parsing issues
1287 Culture.SetCurrentCulture(); 1300 Culture.SetCurrentCulture();
1288 1301
1289 while (base.IsRunningInbound) 1302 while (IsRunningInbound)
1290 { 1303 {
1291 try 1304 try
1292 { 1305 {
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs b/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs
index 71f6fe1..2a3d14f 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs
@@ -108,15 +108,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
108 { 108 {
109 if (!pool.ContainsKey(type) || pool[type] == null || (pool[type]).Count == 0) 109 if (!pool.ContainsKey(type) || pool[type] == null || (pool[type]).Count == 0)
110 { 110 {
111// m_log.DebugFormat("[PACKETPOOL]: Building {0} packet", type);
112
111 // Creating a new packet if we cannot reuse an old package 113 // Creating a new packet if we cannot reuse an old package
112 packet = Packet.BuildPacket(type); 114 packet = Packet.BuildPacket(type);
113 } 115 }
114 else 116 else
115 { 117 {
118// m_log.DebugFormat("[PACKETPOOL]: Pulling {0} packet", type);
119
116 // Recycle old packages 120 // Recycle old packages
117 m_packetsReusedStat.Antecedent++; 121 m_packetsReusedStat.Antecedent++;
118 122
119 packet = (pool[type]).Pop(); 123 packet = pool[type].Pop();
120 } 124 }
121 } 125 }
122 126
@@ -227,7 +231,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
227 231
228 if ((pool[type]).Count < 50) 232 if ((pool[type]).Count < 50)
229 { 233 {
230 (pool[type]).Push(packet); 234// m_log.DebugFormat("[PACKETPOOL]: Pushing {0} packet", type);
235
236 pool[type].Push(packet);
231 } 237 }
232 } 238 }
233 break; 239 break;