aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP
diff options
context:
space:
mode:
authorUbitUmarov2016-11-27 15:14:34 +0000
committerUbitUmarov2016-11-27 15:14:34 +0000
commit877d3092b45723a2fe8b3a5bbc224cd5d5e55e82 (patch)
treef11a5b2d85443fefc81e1958c82828a16fc656cc /OpenSim/Region/ClientStack/Linden/UDP
parentfix pool parameters for httptests (diff)
parentHG on links request build the URI in http format with a / at end, this should... (diff)
downloadopensim-SC-877d3092b45723a2fe8b3a5bbc224cd5d5e55e82.zip
opensim-SC-877d3092b45723a2fe8b3a5bbc224cd5d5e55e82.tar.gz
opensim-SC-877d3092b45723a2fe8b3a5bbc224cd5d5e55e82.tar.bz2
opensim-SC-877d3092b45723a2fe8b3a5bbc224cd5d5e55e82.tar.xz
Merge branch 'master' into httptests
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs84
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs8
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs5
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs22
5 files changed, 46 insertions, 75 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 8ba26e8..6cdf6f6 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -606,21 +606,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
606 //m_scene.CloseAllAgents(CircuitCode); 606 //m_scene.CloseAllAgents(CircuitCode);
607 607
608 // Disable UDP handling for this client 608 // Disable UDP handling for this client
609 m_udpClient.Shutdown();
610
611 m_udpClient.OnQueueEmpty -= HandleQueueEmpty; 609 m_udpClient.OnQueueEmpty -= HandleQueueEmpty;
612 m_udpClient.HasUpdates -= HandleHasUpdates; 610 m_udpClient.HasUpdates -= HandleHasUpdates;
613 m_udpClient.OnPacketStats -= PopulateStats; 611 m_udpClient.OnPacketStats -= PopulateStats;
612 m_udpClient.Shutdown();
614 613
615 // Shutdown the image manager 614 // Shutdown the image manager
616 ImageManager.Close(); 615 ImageManager.Close();
617 ImageManager = null; 616 ImageManager = null;
618 617
619 m_entityUpdates = null; 618 m_entityUpdates = new PriorityQueue(1);
620 m_entityProps = null; 619 m_entityProps = new PriorityQueue(1);
621 m_killRecord.Clear(); 620 m_killRecord.Clear();
622 GroupsInView.Clear(); 621 GroupsInView.Clear();
623 m_scene = null; 622// m_scene = null; can't do this unless checks are added everywhere due to workitems already in pools
623
624 //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); 624 //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false));
625 //GC.Collect(); 625 //GC.Collect();
626 //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true)); 626 //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true));
@@ -3126,10 +3126,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3126 reply.Data.ActualArea = land.Area; 3126 reply.Data.ActualArea = land.Area;
3127 reply.Data.BillableArea = land.Area; // TODO: what is this? 3127 reply.Data.BillableArea = land.Area; // TODO: what is this?
3128 3128
3129 // Bit 0: Mature, bit 7: on sale, other bits: no idea 3129 reply.Data.Flags = (byte)Util.ConvertAccessLevelToMaturity((byte)info.AccessLevel);
3130 reply.Data.Flags = (byte)( 3130 if((land.Flags & (uint)ParcelFlags.ForSale) != 0)
3131 (info.AccessLevel > 13 ? (1 << 0) : 0) + 3131 reply.Data.Flags |= (byte)((1 << 7));
3132 ((land.Flags & (uint)ParcelFlags.ForSale) != 0 ? (1 << 7) : 0));
3133 3132
3134 Vector3 pos = land.UserLocation; 3133 Vector3 pos = land.UserLocation;
3135 if (pos.Equals(Vector3.Zero)) 3134 if (pos.Equals(Vector3.Zero))
@@ -4371,7 +4370,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4371 4370
4372 ushort timeDilation; 4371 ushort timeDilation;
4373 4372
4374 if(m_scene == null) 4373 if(!IsActive)
4375 return; 4374 return;
4376 4375
4377 timeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f); 4376 timeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);
@@ -9614,61 +9613,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9614 9613
9615 #region Parcel related packets 9614 #region Parcel related packets
9616 9615
9617 // acumulate several HandleRegionHandleRequest consecutive overlaping requests
9618 // to be done with minimal resources as possible
9619 // variables temporary here while in test
9620
9621 Queue<UUID> RegionHandleRequests = new Queue<UUID>();
9622 bool RegionHandleRequestsInService = false;
9623
9624 private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack) 9616 private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack)
9625 { 9617 {
9626 UUID currentUUID;
9627
9628 RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest; 9618 RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest;
9629 9619
9630 if (handlerRegionHandleRequest == null) 9620 if (handlerRegionHandleRequest != null)
9631 return true;
9632
9633 RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack;
9634
9635 lock (RegionHandleRequests)
9636 {
9637 if (RegionHandleRequestsInService)
9638 {
9639 // we are already busy doing a previus request
9640 // so enqueue it
9641 RegionHandleRequests.Enqueue(rhrPack.RequestBlock.RegionID);
9642 return true;
9643 }
9644
9645 // else do it
9646 currentUUID = rhrPack.RequestBlock.RegionID;
9647 RegionHandleRequestsInService = true;
9648 }
9649
9650 while (true)
9651 { 9621 {
9652 handlerRegionHandleRequest(this, currentUUID); 9622 RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack;
9653 9623 handlerRegionHandleRequest(this, rhrPack.RequestBlock.RegionID);
9654 lock (RegionHandleRequests)
9655 {
9656 // exit condition, nothing to do or closed
9657 // current code seems to assume we may loose the handler at anytime,
9658 // so keep checking it
9659 handlerRegionHandleRequest = OnRegionHandleRequest;
9660
9661 if (RegionHandleRequests.Count == 0 || !IsActive || handlerRegionHandleRequest == null)
9662 {
9663 RegionHandleRequests.Clear();
9664 RegionHandleRequestsInService = false;
9665 return true;
9666 }
9667 currentUUID = RegionHandleRequests.Dequeue();
9668 }
9669 } 9624 }
9670 9625
9671 return true; // actually unreached 9626 return true;
9672 } 9627 }
9673 9628
9674 private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack) 9629 private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack)
@@ -12945,9 +12900,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12945 /// provide your own method.</param> 12900 /// provide your own method.</param>
12946 protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting, UnackedPacketMethod method) 12901 protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting, UnackedPacketMethod method)
12947 { 12902 {
12903
12904/* this is causing packet loss for some reason
12905 if(!m_udpClient.IsConnected)
12906 {
12907 PacketPool.Instance.ReturnPacket(packet);
12908 return;
12909 }
12910*/
12948 if (m_outPacketsToDrop != null) 12911 if (m_outPacketsToDrop != null)
12912 {
12949 if (m_outPacketsToDrop.Contains(packet.Type.ToString())) 12913 if (m_outPacketsToDrop.Contains(packet.Type.ToString()))
12914 {
12915 PacketPool.Instance.ReturnPacket(packet);
12950 return; 12916 return;
12917 }
12918 }
12951 12919
12952 if (DebugPacketLevel > 0) 12920 if (DebugPacketLevel > 0)
12953 { 12921 {
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
index e85cee2..dc8ac3c 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
@@ -288,21 +288,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
288 for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++) 288 for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++)
289 { 289 {
290 m_packetOutboxes[i].Clear(); 290 m_packetOutboxes[i].Clear();
291 m_throttleCategories[i] = null;
292 m_nextPackets[i] = null; 291 m_nextPackets[i] = null;
293 } 292 }
294 293
295 // pull the throttle out of the scene throttle 294 // pull the throttle out of the scene throttle
296 m_throttleClient.Parent.UnregisterRequest(m_throttleClient); 295 m_throttleClient.Parent.UnregisterRequest(m_throttleClient);
297 m_throttleClient = null;
298 OnPacketStats = null;
299 OnQueueEmpty = null;
300 PendingAcks.Clear(); 296 PendingAcks.Clear();
301 NeedAcks.Clear(); 297 NeedAcks.Clear();
302 NeedAcks = null;
303 PendingAcks = null;
304 m_nextPackets = null;
305 m_packetOutboxes = null;
306 } 298 }
307 299
308 /// <summary> 300 /// <summary>
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index af33d17..a868e3a 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -521,7 +521,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
521 521
522// if (usePools) 522// if (usePools)
523// EnablePools(); 523// EnablePools();
524 DisablePools(); 524 base.DisablePools();
525 } 525 }
526 526
527 public void Start() 527 public void Start()
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
index 7171974..4d726b4 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
@@ -179,6 +179,11 @@ namespace OpenMetaverse
179 // m_dropRandomGenerator = new Random(); 179 // m_dropRandomGenerator = new Random();
180 } 180 }
181 181
182 ~OpenSimUDPBase()
183 {
184 if(m_udpSocket !=null)
185 try { m_udpSocket.Close(); } catch { }
186 }
182 /// <summary> 187 /// <summary>
183 /// Start inbound UDP packet handling. 188 /// Start inbound UDP packet handling.
184 /// </summary> 189 /// </summary>
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
index d4603f8..cac57b2 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
@@ -97,7 +97,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
97 /// </summary> 97 /// </summary>
98 protected float m_burst; 98 protected float m_burst;
99 99
100 public virtual float MaxDripRate { get; set; } 100 protected float m_maxDripRate = 0;
101 public virtual float MaxDripRate
102 {
103 get { return m_maxDripRate; }
104 set { m_maxDripRate = value; }
105 }
101 106
102 public float RequestedBurst 107 public float RequestedBurst
103 { 108 {
@@ -134,7 +139,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
134 /// the system tick interval (typically around 15-22ms)</remarks> 139 /// the system tick interval (typically around 15-22ms)</remarks>
135 protected float m_dripRate; 140 protected float m_dripRate;
136 141
137 public virtual float RequestedDripRate 142 public float RequestedDripRate
138 { 143 {
139 get { return (m_dripRate == 0 ? m_totalDripRequest : m_dripRate); } 144 get { return (m_dripRate == 0 ? m_totalDripRequest : m_dripRate); }
140 set { 145 set {
@@ -146,7 +151,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
146 } 151 }
147 } 152 }
148 153
149 public virtual float DripRate 154 public float DripRate
150 { 155 {
151 get { 156 get {
152 float rate = Math.Min(RequestedDripRate,TotalDripRequest); 157 float rate = Math.Min(RequestedDripRate,TotalDripRequest);
@@ -344,7 +349,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
344 // greater than this. 349 // greater than this.
345 // </summary> 350 // </summary>
346 351
347 protected float m_maxDripRate = 0;
348 public override float MaxDripRate 352 public override float MaxDripRate
349 { 353 {
350 get { return (m_maxDripRate == 0 ? m_totalDripRequest : m_maxDripRate); } 354 get { return (m_maxDripRate == 0 ? m_totalDripRequest : m_maxDripRate); }
@@ -359,7 +363,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
359 // <summary> 363 // <summary>
360 // Adjust drip rate in response to network conditions. 364 // Adjust drip rate in response to network conditions.
361 // </summary> 365 // </summary>
362 public virtual float AdjustedDripRate 366 public float AdjustedDripRate
363 { 367 {
364 get { return m_dripRate; } 368 get { return m_dripRate; }
365 set 369 set
@@ -380,12 +384,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
380 { 384 {
381 m_enabled = enabled; 385 m_enabled = enabled;
382 386
383 MaxDripRate = maxDripRate; 387 m_maxDripRate = (maxDripRate == 0 ? m_totalDripRequest : Math.Max(maxDripRate, m_minimumFlow));
384 388
385 if (enabled) 389 if (enabled)
386 AdjustedDripRate = m_maxDripRate * .5f; 390 m_dripRate = m_maxDripRate * .5f;
387 else 391 else
388 AdjustedDripRate = m_maxDripRate; 392 m_dripRate = m_maxDripRate;
393 if (m_parent != null)
394 m_parent.RegisterRequest(this, m_dripRate);
389 } 395 }
390 396
391 /// <summary> 397 /// <summary>