aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs38
1 files changed, 23 insertions, 15 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 5ce82a5..18d5606 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
308 308
309 309
310 310
311 private ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>(); 311// private ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>();
312 312 private Dictionary<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new Dictionary<IPEndPoint, Queue<UDPPacketBuffer>>();
313 /// <summary> 313 /// <summary>
314 /// Event used to signal when queued packets are available for sending. 314 /// Event used to signal when queued packets are available for sending.
315 /// </summary> 315 /// </summary>
@@ -1416,10 +1416,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1416 // And if there is a UseCircuitCode pending, also drop it 1416 // And if there is a UseCircuitCode pending, also drop it
1417 lock (m_pendingCache) 1417 lock (m_pendingCache)
1418 { 1418 {
1419 if (m_pendingCache.Contains(endPoint)) 1419// if (m_pendingCache.Contains(endPoint))
1420 if (m_pendingCache.ContainsKey(endPoint))
1420 return; 1421 return;
1421 1422
1422 m_pendingCache.AddOrUpdate(endPoint, new Queue<UDPPacketBuffer>(), 60); 1423// m_pendingCache.AddOrUpdate(endPoint, new Queue<UDPPacketBuffer>(), 60);
1424 m_pendingCache.Add(endPoint, new Queue<UDPPacketBuffer>());
1423 } 1425 }
1424 1426
1425 // We need to copy the endpoint so that it doesn't get changed when another thread reuses the 1427 // We need to copy the endpoint so that it doesn't get changed when another thread reuses the
@@ -1765,10 +1767,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1765 uccp.CircuitCode.SessionID, 1767 uccp.CircuitCode.SessionID,
1766 endPoint, 1768 endPoint,
1767 sessionInfo); 1769 sessionInfo);
1768 1770
1769 // Now we know we can handle more data
1770 Thread.Sleep(200);
1771
1772 // Obtain the pending queue and remove it from the cache 1771 // Obtain the pending queue and remove it from the cache
1773 Queue<UDPPacketBuffer> queue = null; 1772 Queue<UDPPacketBuffer> queue = null;
1774 1773
@@ -1786,13 +1785,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1786 m_log.DebugFormat("[LLUDPSERVER]: Client created, processing pending queue, {0} entries", queue.Count); 1785 m_log.DebugFormat("[LLUDPSERVER]: Client created, processing pending queue, {0} entries", queue.Count);
1787 1786
1788 // Reinject queued packets 1787 // Reinject queued packets
1789 while (queue.Count > 0) 1788 if (queue != null)
1790 { 1789 {
1791 UDPPacketBuffer buf = queue.Dequeue(); 1790 while (queue.Count > 0)
1792 PacketReceived(buf); 1791 {
1793 } 1792 UDPPacketBuffer buf = queue.Dequeue();
1793 PacketReceived(buf);
1794 }
1794 1795
1795 queue = null; 1796 queue = null;
1797 }
1796 1798
1797 // Send ack straight away to let the viewer know that the connection is active. 1799 // Send ack straight away to let the viewer know that the connection is active.
1798 // The client will be null if it already exists (e.g. if on a region crossing the client sends a use 1800 // The client will be null if it already exists (e.g. if on a region crossing the client sends a use
@@ -1815,6 +1817,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1815 m_log.WarnFormat( 1817 m_log.WarnFormat(
1816 "[LLUDPSERVER]: Ignoring connection request for {0} to {1} with unknown circuit code {2} from IP {3}", 1818 "[LLUDPSERVER]: Ignoring connection request for {0} to {1} with unknown circuit code {2} from IP {3}",
1817 uccp.CircuitCode.ID, m_scene.RegionInfo.RegionName, uccp.CircuitCode.Code, endPoint); 1819 uccp.CircuitCode.ID, m_scene.RegionInfo.RegionName, uccp.CircuitCode.Code, endPoint);
1820
1818 lock (m_pendingCache) 1821 lock (m_pendingCache)
1819 m_pendingCache.Remove(endPoint); 1822 m_pendingCache.Remove(endPoint);
1820 } 1823 }
@@ -1825,6 +1828,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1825 } 1828 }
1826 catch (Exception e) 1829 catch (Exception e)
1827 { 1830 {
1831 // this may already be done.. or not..
1832 lock (m_pendingCache)
1833 m_pendingCache.Remove(endPoint);
1834
1828 m_log.ErrorFormat( 1835 m_log.ErrorFormat(
1829 "[LLUDPSERVER]: UseCircuitCode handling from endpoint {0}, client {1} {2} failed. Exception {3}{4}", 1836 "[LLUDPSERVER]: UseCircuitCode handling from endpoint {0}, client {1} {2} failed. Exception {3}{4}",
1830 endPoint != null ? endPoint.ToString() : "n/a", 1837 endPoint != null ? endPoint.ToString() : "n/a",
@@ -2058,11 +2065,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2058 "[LLUDPSERVER]: No packets received from {0} agent of {1} for {2}ms in {3}. Disconnecting.", 2065 "[LLUDPSERVER]: No packets received from {0} agent of {1} for {2}ms in {3}. Disconnecting.",
2059 client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, timeoutTicks, m_scene.Name); 2066 client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, timeoutTicks, m_scene.Name);
2060 2067
2061 if (!client.SceneAgent.IsChildAgent) 2068 if (client.SceneAgent != null && !client.SceneAgent.IsChildAgent)
2062 client.Kick("Simulator logged you out due to connection timeout."); 2069 client.Kick("Simulator logged you out due to connection timeout.");
2063 } 2070 }
2064 2071
2065 m_scene.CloseAgent(client.AgentId, true); 2072 if (!m_scene.CloseAgent(client.AgentId, true))
2073 client.Close(true,true);
2066 } 2074 }
2067 2075
2068 private void IncomingPacketHandler() 2076 private void IncomingPacketHandler()