Save packets received while the client is added and replay them later.
parent
8baf4dcc78
commit
283df0610d
|
@ -153,6 +153,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
/// <summary>Flag to signal when clients should send pings</summary>
|
/// <summary>Flag to signal when clients should send pings</summary>
|
||||||
private bool m_sendPing;
|
private bool m_sendPing;
|
||||||
|
|
||||||
|
private ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>();
|
||||||
|
|
||||||
private int m_defaultRTO = 0;
|
private int m_defaultRTO = 0;
|
||||||
private int m_maxRTO = 0;
|
private int m_maxRTO = 0;
|
||||||
|
|
||||||
|
@ -701,6 +703,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
object[] array = new object[] { buffer, packet };
|
object[] array = new object[] { buffer, packet };
|
||||||
|
|
||||||
|
lock (m_pendingCache)
|
||||||
|
m_pendingCache.AddOrUpdate(address, new Queue<UDPPacketBuffer>(), 60);
|
||||||
Util.FireAndForget(HandleUseCircuitCode, array);
|
Util.FireAndForget(HandleUseCircuitCode, array);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -710,6 +714,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
IClientAPI client;
|
IClientAPI client;
|
||||||
if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView))
|
if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView))
|
||||||
{
|
{
|
||||||
|
lock (m_pendingCache)
|
||||||
|
{
|
||||||
|
Queue<UDPPacketBuffer> queue;
|
||||||
|
if (m_pendingCache.TryGetValue(address, out queue))
|
||||||
|
queue.Enqueue(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
// m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName);
|
// m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -943,6 +954,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
// We only want to send initial data to new clients, not ones which are being converted from child to root.
|
// We only want to send initial data to new clients, not ones which are being converted from child to root.
|
||||||
if (client != null)
|
if (client != null)
|
||||||
client.SceneAgent.SendInitialDataToMe();
|
client.SceneAgent.SendInitialDataToMe();
|
||||||
|
|
||||||
|
// Now we know we can handle more data
|
||||||
|
Thread.Sleep(200);
|
||||||
|
|
||||||
|
// Obtain the queue and remove it from the cache
|
||||||
|
Queue<UDPPacketBuffer> queue = null;
|
||||||
|
|
||||||
|
lock (m_pendingCache)
|
||||||
|
{
|
||||||
|
if (!m_pendingCache.TryGetValue(remoteEndPoint, out queue))
|
||||||
|
return;
|
||||||
|
m_pendingCache.Remove(remoteEndPoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reinject queued packets
|
||||||
|
while(queue.Count > 0)
|
||||||
|
{
|
||||||
|
UDPPacketBuffer buf = queue.Dequeue();
|
||||||
|
PacketReceived(buf);
|
||||||
|
}
|
||||||
|
queue = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -950,6 +982,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
m_log.WarnFormat(
|
m_log.WarnFormat(
|
||||||
"[LLUDPSERVER]: Connection request for client {0} connecting with unnotified circuit code {1} from {2}",
|
"[LLUDPSERVER]: Connection request for client {0} connecting with unnotified circuit code {1} from {2}",
|
||||||
uccp.CircuitCode.ID, uccp.CircuitCode.Code, remoteEndPoint);
|
uccp.CircuitCode.ID, uccp.CircuitCode.Code, remoteEndPoint);
|
||||||
|
lock (m_pendingCache)
|
||||||
|
m_pendingCache.Remove(remoteEndPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
|
|
Loading…
Reference in New Issue