From 3d9f25a19dda7c54ae50fd9b4da38247371018f3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 14 Sep 2014 02:28:42 +0100 Subject: revert changes to m_pendingCache and remove client close if there is no SP, as requested --- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 35 +++++++++------------- 1 file changed, 14 insertions(+), 21 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 18d5606..d811b64 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -308,8 +308,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP -// private ExpiringCache> m_pendingCache = new ExpiringCache>(); - private Dictionary> m_pendingCache = new Dictionary>(); + private ExpiringCache> m_pendingCache = new ExpiringCache>(); + /// /// Event used to signal when queued packets are available for sending. /// @@ -1416,12 +1416,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP // And if there is a UseCircuitCode pending, also drop it lock (m_pendingCache) { -// if (m_pendingCache.Contains(endPoint)) - if (m_pendingCache.ContainsKey(endPoint)) + if (m_pendingCache.Contains(endPoint)) return; -// m_pendingCache.AddOrUpdate(endPoint, new Queue(), 60); - m_pendingCache.Add(endPoint, new Queue()); + m_pendingCache.AddOrUpdate(endPoint, new Queue(), 60); } // We need to copy the endpoint so that it doesn't get changed when another thread reuses the @@ -1767,7 +1765,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP uccp.CircuitCode.SessionID, endPoint, sessionInfo); - + + // Now we know we can handle more data + Thread.Sleep(200); + // Obtain the pending queue and remove it from the cache Queue queue = null; @@ -1785,17 +1786,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_log.DebugFormat("[LLUDPSERVER]: Client created, processing pending queue, {0} entries", queue.Count); // Reinject queued packets - if (queue != null) + while (queue.Count > 0) { - while (queue.Count > 0) - { - UDPPacketBuffer buf = queue.Dequeue(); - PacketReceived(buf); - } - - queue = null; + UDPPacketBuffer buf = queue.Dequeue(); + PacketReceived(buf); } + queue = null; + // Send ack straight away to let the viewer know that the connection is active. // The client will be null if it already exists (e.g. if on a region crossing the client sends a use // circuit code to the existing child agent. This is not particularly obvious. @@ -1828,10 +1826,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP } catch (Exception e) { - // this may already be done.. or not.. - lock (m_pendingCache) - m_pendingCache.Remove(endPoint); - m_log.ErrorFormat( "[LLUDPSERVER]: UseCircuitCode handling from endpoint {0}, client {1} {2} failed. Exception {3}{4}", endPoint != null ? endPoint.ToString() : "n/a", @@ -2069,8 +2063,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP client.Kick("Simulator logged you out due to connection timeout."); } - if (!m_scene.CloseAgent(client.AgentId, true)) - client.Close(true,true); + m_scene.CloseAgent(client.AgentId, true); } private void IncomingPacketHandler() -- cgit v1.1