aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
diff options
context:
space:
mode:
authorJohn Hurliman2009-10-16 14:17:13 -0700
committerJohn Hurliman2009-10-16 14:17:13 -0700
commit1bd9202f2439ac73a70fa2a881f824797f61f589 (patch)
treeed09eb3671f5bbdec15baf4aaf9069f6ea203902 /OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim into priorit... (diff)
downloadopensim-SC_OLD-1bd9202f2439ac73a70fa2a881f824797f61f589.zip
opensim-SC_OLD-1bd9202f2439ac73a70fa2a881f824797f61f589.tar.gz
opensim-SC_OLD-1bd9202f2439ac73a70fa2a881f824797f61f589.tar.bz2
opensim-SC_OLD-1bd9202f2439ac73a70fa2a881f824797f61f589.tar.xz
* Simplified the prioritization packet creation code to reduce CPU usage and increase throughput. Apologies to Jim for hacking on your code while it's only halfway done, I'll take responsibility for the manual merge
* Changed LLUDP to use its own MTU value of 1400 instead of the 1200 value pulled from the currently shipped libomv
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs9
1 files changed, 6 insertions, 3 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index b11a80d..f2b8720 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -89,6 +89,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
89 /// </summary> 89 /// </summary>
90 public class LLUDPServer : OpenSimUDPBase 90 public class LLUDPServer : OpenSimUDPBase
91 { 91 {
92 /// <summary>Maximum transmission unit, or UDP packet size, for the LLUDP protocol</summary>
93 public const int MTU = 1400;
94
92 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 95 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
93 96
94 /// <summary>Handlers for incoming packets</summary> 97 /// <summary>Handlers for incoming packets</summary>
@@ -272,7 +275,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
272 // The vast majority of packets are less than 200 bytes, although due to asset transfers and packet splitting 275 // The vast majority of packets are less than 200 bytes, although due to asset transfers and packet splitting
273 // there are a decent number of packets in the 1000-1140 byte range. We allocate one of two sizes of data here 276 // there are a decent number of packets in the 1000-1140 byte range. We allocate one of two sizes of data here
274 // to accomodate for both common scenarios and provide ample room for ACK appending in both 277 // to accomodate for both common scenarios and provide ample room for ACK appending in both
275 int bufferSize = (dataLength > 180) ? Packet.MTU : 200; 278 int bufferSize = (dataLength > 180) ? LLUDPServer.MTU : 200;
276 279
277 UDPPacketBuffer buffer = new UDPPacketBuffer(udpClient.RemoteEndPoint, bufferSize); 280 UDPPacketBuffer buffer = new UDPPacketBuffer(udpClient.RemoteEndPoint, bufferSize);
278 281
@@ -569,9 +572,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
569 // client.BytesSinceLastACK. Lockless thread safety 572 // client.BytesSinceLastACK. Lockless thread safety
570 int bytesSinceLastACK = Interlocked.Exchange(ref udpClient.BytesSinceLastACK, 0); 573 int bytesSinceLastACK = Interlocked.Exchange(ref udpClient.BytesSinceLastACK, 0);
571 bytesSinceLastACK += buffer.DataLength; 574 bytesSinceLastACK += buffer.DataLength;
572 if (bytesSinceLastACK > Packet.MTU * 2) 575 if (bytesSinceLastACK > LLUDPServer.MTU * 2)
573 { 576 {
574 bytesSinceLastACK -= Packet.MTU * 2; 577 bytesSinceLastACK -= LLUDPServer.MTU * 2;
575 SendAcks(udpClient); 578 SendAcks(udpClient);
576 } 579 }
577 Interlocked.Add(ref udpClient.BytesSinceLastACK, bytesSinceLastACK); 580 Interlocked.Add(ref udpClient.BytesSinceLastACK, bytesSinceLastACK);