diff options
author | Justin Clark-Casey (justincc) | 2012-10-12 01:39:37 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-10-12 01:39:37 +0100 |
commit | 21d0cbf7038cfb1b1010310a0f4b455cf9ab700d (patch) | |
tree | 8c5da5b12384379c57c8c424f2745ef7e02f1173 /OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |
parent | BulletSim: fix problem with some shapes (like cylinders) being implemented as... (diff) | |
download | opensim-SC-21d0cbf7038cfb1b1010310a0f4b455cf9ab700d.zip opensim-SC-21d0cbf7038cfb1b1010310a0f4b455cf9ab700d.tar.gz opensim-SC-21d0cbf7038cfb1b1010310a0f4b455cf9ab700d.tar.bz2 opensim-SC-21d0cbf7038cfb1b1010310a0f4b455cf9ab700d.tar.xz |
Add AgentUpdate to PacketPool. This is the most common inbound packet from viewers.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 6d2cda5..e3f4679 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -100,9 +100,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
100 | 100 | ||
101 | /// <summary>The measured resolution of Environment.TickCount</summary> | 101 | /// <summary>The measured resolution of Environment.TickCount</summary> |
102 | public readonly float TickCountResolution; | 102 | public readonly float TickCountResolution; |
103 | |||
103 | /// <summary>Number of prim updates to put on the queue each time the | 104 | /// <summary>Number of prim updates to put on the queue each time the |
104 | /// OnQueueEmpty event is triggered for updates</summary> | 105 | /// OnQueueEmpty event is triggered for updates</summary> |
105 | public readonly int PrimUpdatesPerCallback; | 106 | public readonly int PrimUpdatesPerCallback; |
107 | |||
106 | /// <summary>Number of texture packets to put on the queue each time the | 108 | /// <summary>Number of texture packets to put on the queue each time the |
107 | /// OnQueueEmpty event is triggered for textures</summary> | 109 | /// OnQueueEmpty event is triggered for textures</summary> |
108 | public readonly int TextureSendLimit; | 110 | public readonly int TextureSendLimit; |
@@ -111,6 +113,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
111 | //PacketEventDictionary packetEvents = new PacketEventDictionary(); | 113 | //PacketEventDictionary packetEvents = new PacketEventDictionary(); |
112 | /// <summary>Incoming packets that are awaiting handling</summary> | 114 | /// <summary>Incoming packets that are awaiting handling</summary> |
113 | private OpenMetaverse.BlockingQueue<IncomingPacket> packetInbox = new OpenMetaverse.BlockingQueue<IncomingPacket>(); | 115 | private OpenMetaverse.BlockingQueue<IncomingPacket> packetInbox = new OpenMetaverse.BlockingQueue<IncomingPacket>(); |
116 | |||
114 | /// <summary></summary> | 117 | /// <summary></summary> |
115 | //private UDPClientCollection m_clients = new UDPClientCollection(); | 118 | //private UDPClientCollection m_clients = new UDPClientCollection(); |
116 | /// <summary>Bandwidth throttle for this UDP server</summary> | 119 | /// <summary>Bandwidth throttle for this UDP server</summary> |
@@ -121,28 +124,37 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
121 | 124 | ||
122 | /// <summary>Manages authentication for agent circuits</summary> | 125 | /// <summary>Manages authentication for agent circuits</summary> |
123 | private AgentCircuitManager m_circuitManager; | 126 | private AgentCircuitManager m_circuitManager; |
127 | |||
124 | /// <summary>Reference to the scene this UDP server is attached to</summary> | 128 | /// <summary>Reference to the scene this UDP server is attached to</summary> |
125 | protected Scene m_scene; | 129 | protected Scene m_scene; |
130 | |||
126 | /// <summary>The X/Y coordinates of the scene this UDP server is attached to</summary> | 131 | /// <summary>The X/Y coordinates of the scene this UDP server is attached to</summary> |
127 | private Location m_location; | 132 | private Location m_location; |
133 | |||
128 | /// <summary>The size of the receive buffer for the UDP socket. This value | 134 | /// <summary>The size of the receive buffer for the UDP socket. This value |
129 | /// is passed up to the operating system and used in the system networking | 135 | /// is passed up to the operating system and used in the system networking |
130 | /// stack. Use zero to leave this value as the default</summary> | 136 | /// stack. Use zero to leave this value as the default</summary> |
131 | private int m_recvBufferSize; | 137 | private int m_recvBufferSize; |
138 | |||
132 | /// <summary>Flag to process packets asynchronously or synchronously</summary> | 139 | /// <summary>Flag to process packets asynchronously or synchronously</summary> |
133 | private bool m_asyncPacketHandling; | 140 | private bool m_asyncPacketHandling; |
141 | |||
134 | /// <summary>Tracks whether or not a packet was sent each round so we know | 142 | /// <summary>Tracks whether or not a packet was sent each round so we know |
135 | /// whether or not to sleep</summary> | 143 | /// whether or not to sleep</summary> |
136 | private bool m_packetSent; | 144 | private bool m_packetSent; |
137 | 145 | ||
138 | /// <summary>Environment.TickCount of the last time that packet stats were reported to the scene</summary> | 146 | /// <summary>Environment.TickCount of the last time that packet stats were reported to the scene</summary> |
139 | private int m_elapsedMSSinceLastStatReport = 0; | 147 | private int m_elapsedMSSinceLastStatReport = 0; |
148 | |||
140 | /// <summary>Environment.TickCount of the last time the outgoing packet handler executed</summary> | 149 | /// <summary>Environment.TickCount of the last time the outgoing packet handler executed</summary> |
141 | private int m_tickLastOutgoingPacketHandler; | 150 | private int m_tickLastOutgoingPacketHandler; |
151 | |||
142 | /// <summary>Keeps track of the number of elapsed milliseconds since the last time the outgoing packet handler looped</summary> | 152 | /// <summary>Keeps track of the number of elapsed milliseconds since the last time the outgoing packet handler looped</summary> |
143 | private int m_elapsedMSOutgoingPacketHandler; | 153 | private int m_elapsedMSOutgoingPacketHandler; |
154 | |||
144 | /// <summary>Keeps track of the number of 100 millisecond periods elapsed in the outgoing packet handler executed</summary> | 155 | /// <summary>Keeps track of the number of 100 millisecond periods elapsed in the outgoing packet handler executed</summary> |
145 | private int m_elapsed100MSOutgoingPacketHandler; | 156 | private int m_elapsed100MSOutgoingPacketHandler; |
157 | |||
146 | /// <summary>Keeps track of the number of 500 millisecond periods elapsed in the outgoing packet handler executed</summary> | 158 | /// <summary>Keeps track of the number of 500 millisecond periods elapsed in the outgoing packet handler executed</summary> |
147 | private int m_elapsed500MSOutgoingPacketHandler; | 159 | private int m_elapsed500MSOutgoingPacketHandler; |
148 | 160 | ||
@@ -739,7 +751,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
739 | 751 | ||
740 | try | 752 | try |
741 | { | 753 | { |
742 | packet = Packet.BuildPacket(buffer.Data, ref packetEnd, | 754 | // packet = Packet.BuildPacket(buffer.Data, ref packetEnd, |
755 | // // Only allocate a buffer for zerodecoding if the packet is zerocoded | ||
756 | // ((buffer.Data[0] & Helpers.MSG_ZEROCODED) != 0) ? new byte[4096] : null); | ||
757 | packet = PacketPool.Instance.GetPacket(buffer.Data, ref packetEnd, | ||
743 | // Only allocate a buffer for zerodecoding if the packet is zerocoded | 758 | // Only allocate a buffer for zerodecoding if the packet is zerocoded |
744 | ((buffer.Data[0] & Helpers.MSG_ZEROCODED) != 0) ? new byte[4096] : null); | 759 | ((buffer.Data[0] & Helpers.MSG_ZEROCODED) != 0) ? new byte[4096] : null); |
745 | } | 760 | } |
@@ -754,11 +769,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
754 | 769 | ||
755 | return; // Drop short packet | 770 | return; // Drop short packet |
756 | } | 771 | } |
757 | catch(Exception e) | 772 | catch (Exception e) |
758 | { | 773 | { |
759 | if (m_malformedCount < 100) | 774 | if (m_malformedCount < 100) |
760 | m_log.DebugFormat("[LLUDPSERVER]: Dropped malformed packet: " + e.ToString()); | 775 | m_log.DebugFormat("[LLUDPSERVER]: Dropped malformed packet: " + e.ToString()); |
776 | |||
761 | m_malformedCount++; | 777 | m_malformedCount++; |
778 | |||
762 | if ((m_malformedCount % 100000) == 0) | 779 | if ((m_malformedCount % 100000) == 0) |
763 | m_log.DebugFormat("[LLUDPSERVER]: Received {0} malformed packets so far, probable network attack.", m_malformedCount); | 780 | m_log.DebugFormat("[LLUDPSERVER]: Received {0} malformed packets so far, probable network attack.", m_malformedCount); |
764 | } | 781 | } |