revert changes to m_pendingCache and remove client close if there is no

SP, as requested
avinationmerge
UbitUmarov 2014-09-14 02:28:42 +01:00
parent 52cde5fe96
commit 3d9f25a19d
1 changed files with 14 additions and 21 deletions

View File

@ -308,8 +308,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// private ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>(); private ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>();
private Dictionary<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new Dictionary<IPEndPoint, Queue<UDPPacketBuffer>>();
/// <summary> /// <summary>
/// Event used to signal when queued packets are available for sending. /// Event used to signal when queued packets are available for sending.
/// </summary> /// </summary>
@ -1416,12 +1416,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// And if there is a UseCircuitCode pending, also drop it // And if there is a UseCircuitCode pending, also drop it
lock (m_pendingCache) lock (m_pendingCache)
{ {
// if (m_pendingCache.Contains(endPoint)) if (m_pendingCache.Contains(endPoint))
if (m_pendingCache.ContainsKey(endPoint))
return; return;
// m_pendingCache.AddOrUpdate(endPoint, new Queue<UDPPacketBuffer>(), 60); m_pendingCache.AddOrUpdate(endPoint, new Queue<UDPPacketBuffer>(), 60);
m_pendingCache.Add(endPoint, new Queue<UDPPacketBuffer>());
} }
// We need to copy the endpoint so that it doesn't get changed when another thread reuses the // We need to copy the endpoint so that it doesn't get changed when another thread reuses the
@ -1768,6 +1766,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
endPoint, endPoint,
sessionInfo); sessionInfo);
// Now we know we can handle more data
Thread.Sleep(200);
// Obtain the pending queue and remove it from the cache // Obtain the pending queue and remove it from the cache
Queue<UDPPacketBuffer> queue = null; Queue<UDPPacketBuffer> queue = null;
@ -1785,8 +1786,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_log.DebugFormat("[LLUDPSERVER]: Client created, processing pending queue, {0} entries", queue.Count); m_log.DebugFormat("[LLUDPSERVER]: Client created, processing pending queue, {0} entries", queue.Count);
// Reinject queued packets // Reinject queued packets
if (queue != null)
{
while (queue.Count > 0) while (queue.Count > 0)
{ {
UDPPacketBuffer buf = queue.Dequeue(); UDPPacketBuffer buf = queue.Dequeue();
@ -1794,7 +1793,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
queue = null; queue = null;
}
// Send ack straight away to let the viewer know that the connection is active. // 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 // The client will be null if it already exists (e.g. if on a region crossing the client sends a use
@ -1828,10 +1826,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
catch (Exception e) catch (Exception e)
{ {
// this may already be done.. or not..
lock (m_pendingCache)
m_pendingCache.Remove(endPoint);
m_log.ErrorFormat( m_log.ErrorFormat(
"[LLUDPSERVER]: UseCircuitCode handling from endpoint {0}, client {1} {2} failed. Exception {3}{4}", "[LLUDPSERVER]: UseCircuitCode handling from endpoint {0}, client {1} {2} failed. Exception {3}{4}",
endPoint != null ? endPoint.ToString() : "n/a", 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."); client.Kick("Simulator logged you out due to connection timeout.");
} }
if (!m_scene.CloseAgent(client.AgentId, true)) m_scene.CloseAgent(client.AgentId, true);
client.Close(true,true);
} }
private void IncomingPacketHandler() private void IncomingPacketHandler()