Revert 7754 and 7755 pending a rework
parent
5320f0f33c
commit
2bcf315ea2
|
@ -99,8 +99,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
//
|
//
|
||||||
private Dictionary<uint, uint> m_PendingAcks = new Dictionary<uint, uint>();
|
private Dictionary<uint, uint> m_PendingAcks = new Dictionary<uint, uint>();
|
||||||
|
|
||||||
private Dictionary<uint, LLQueItem> m_NeedAck =
|
// Dictionary of the packets that need acks from the client.
|
||||||
new Dictionary<uint, LLQueItem>();
|
//
|
||||||
|
private class AckData
|
||||||
|
{
|
||||||
|
public AckData(Packet packet, Object identifier, int tickCount, int resends)
|
||||||
|
{
|
||||||
|
Packet = packet;
|
||||||
|
Identifier = identifier;
|
||||||
|
TickCount = tickCount;
|
||||||
|
Resends = resends;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Packet Packet;
|
||||||
|
public Object Identifier;
|
||||||
|
public int TickCount;
|
||||||
|
public int Resends;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Dictionary<uint, AckData> m_NeedAck =
|
||||||
|
new Dictionary<uint, AckData>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The number of milliseconds that can pass before a packet that needs an ack is resent.
|
/// The number of milliseconds that can pass before a packet that needs an ack is resent.
|
||||||
|
@ -296,9 +314,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
item.throttleType = throttlePacketType;
|
item.throttleType = throttlePacketType;
|
||||||
item.TickCount = System.Environment.TickCount;
|
item.TickCount = System.Environment.TickCount;
|
||||||
item.Identifier = id;
|
item.Identifier = id;
|
||||||
item.Resends = 0;
|
|
||||||
item.Bytes = packet.ToBytes();
|
|
||||||
item.Length = item.Bytes.Length;
|
|
||||||
|
|
||||||
m_PacketQueue.Enqueue(item);
|
m_PacketQueue.Enqueue(item);
|
||||||
m_PacketsSent++;
|
m_PacketsSent++;
|
||||||
|
@ -318,7 +333,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
if (m_DropSafeTimeout > now ||
|
if (m_DropSafeTimeout > now ||
|
||||||
intervalMs > 500) // We were frozen!
|
intervalMs > 500) // We were frozen!
|
||||||
{
|
{
|
||||||
foreach (LLQueItem data in new List<LLQueItem>
|
foreach (AckData data in new List<AckData>
|
||||||
(m_NeedAck.Values))
|
(m_NeedAck.Values))
|
||||||
{
|
{
|
||||||
if (m_DropSafeTimeout > now)
|
if (m_DropSafeTimeout > now)
|
||||||
|
@ -349,7 +364,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
int resent = 0;
|
int resent = 0;
|
||||||
|
|
||||||
foreach (LLQueItem data in new List<LLQueItem>(m_NeedAck.Values))
|
foreach (AckData data in new List<AckData>(m_NeedAck.Values))
|
||||||
{
|
{
|
||||||
Packet packet = data.Packet;
|
Packet packet = data.Packet;
|
||||||
|
|
||||||
|
@ -615,7 +630,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
private void ProcessAck(uint id)
|
private void ProcessAck(uint id)
|
||||||
{
|
{
|
||||||
LLQueItem data;
|
AckData data;
|
||||||
Packet packet;
|
Packet packet;
|
||||||
|
|
||||||
lock (m_NeedAck)
|
lock (m_NeedAck)
|
||||||
|
@ -625,9 +640,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
if (!m_NeedAck.TryGetValue(id, out data))
|
if (!m_NeedAck.TryGetValue(id, out data))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
packet = data.Packet;
|
||||||
|
|
||||||
m_NeedAck.Remove(id);
|
m_NeedAck.Remove(id);
|
||||||
|
m_UnackedBytes -= packet.ToBytes().Length;
|
||||||
PacketPool.Instance.ReturnPacket(data.Packet);
|
PacketPool.Instance.ReturnPacket(data.Packet);
|
||||||
m_UnackedBytes -= data.Length;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -661,7 +678,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
lock (m_NeedAck)
|
lock (m_NeedAck)
|
||||||
{
|
{
|
||||||
foreach (uint key in m_NeedAck.Keys)
|
foreach (uint key in m_NeedAck.Keys)
|
||||||
info.needAck.Add(key, m_NeedAck[key].Bytes);
|
info.needAck.Add(key, m_NeedAck[key].Packet.ToBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
LLQueItem[] queitems = m_PacketQueue.GetQueueArray();
|
LLQueItem[] queitems = m_PacketQueue.GetQueueArray();
|
||||||
|
@ -669,7 +686,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
for (int i = 0; i < queitems.Length; i++)
|
for (int i = 0; i < queitems.Length; i++)
|
||||||
{
|
{
|
||||||
if (queitems[i].Incoming == false)
|
if (queitems[i].Incoming == false)
|
||||||
info.out_packets.Add(queitems[i].Bytes);
|
info.out_packets.Add(queitems[i].Packet.ToBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
info.sequence = m_Sequence;
|
info.sequence = m_Sequence;
|
||||||
|
@ -680,7 +697,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
public void SetClientInfo(ClientInfo info)
|
public void SetClientInfo(ClientInfo info)
|
||||||
{
|
{
|
||||||
m_PendingAcks = info.pendingAcks;
|
m_PendingAcks = info.pendingAcks;
|
||||||
m_NeedAck = new Dictionary<uint, LLQueItem>();
|
m_NeedAck = new Dictionary<uint, AckData>();
|
||||||
|
|
||||||
Packet packet = null;
|
Packet packet = null;
|
||||||
int packetEnd = 0;
|
int packetEnd = 0;
|
||||||
|
@ -699,16 +716,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
LLQueItem item = new LLQueItem();
|
m_NeedAck.Add(key, new AckData(packet, null, System.Environment.TickCount, 0));
|
||||||
item.Packet = packet;
|
|
||||||
item.Incoming = false;
|
|
||||||
item.throttleType = 0;
|
|
||||||
item.TickCount = System.Environment.TickCount;
|
|
||||||
item.Identifier = 0;
|
|
||||||
item.Resends = 0;
|
|
||||||
item.Bytes = packet.ToBytes();
|
|
||||||
item.Length = item.Bytes.Length;
|
|
||||||
m_NeedAck.Add(key, item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Sequence = info.sequence;
|
m_Sequence = info.sequence;
|
||||||
|
@ -732,7 +740,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
private void DropResend(Object id)
|
private void DropResend(Object id)
|
||||||
{
|
{
|
||||||
foreach (LLQueItem data in new List<LLQueItem>(m_NeedAck.Values))
|
foreach (AckData data in new List<AckData>(m_NeedAck.Values))
|
||||||
{
|
{
|
||||||
if (data.Identifier != null && data.Identifier == id)
|
if (data.Identifier != null && data.Identifier == id)
|
||||||
{
|
{
|
||||||
|
@ -769,12 +777,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
// We want to see that packet arrive if it's reliable
|
// We want to see that packet arrive if it's reliable
|
||||||
if (packet.Header.Reliable)
|
if (packet.Header.Reliable)
|
||||||
{
|
{
|
||||||
m_UnackedBytes += item.Length;
|
m_UnackedBytes += packet.ToBytes().Length;
|
||||||
|
|
||||||
// Keep track of when this packet was sent out
|
// Keep track of when this packet was sent out
|
||||||
item.TickCount = System.Environment.TickCount;
|
m_NeedAck[packet.Header.Sequence] = new AckData(packet,
|
||||||
|
item.Identifier, System.Environment.TickCount,
|
||||||
m_NeedAck[packet.Header.Sequence] = item;
|
0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -784,7 +792,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
Abort();
|
Abort();
|
||||||
|
|
||||||
// Actually make the byte array and send it
|
// Actually make the byte array and send it
|
||||||
byte[] sendbuffer = item.Bytes;
|
byte[] sendbuffer = packet.ToBytes();
|
||||||
|
|
||||||
//m_log.DebugFormat(
|
//m_log.DebugFormat(
|
||||||
// "[CLIENT]: In {0} sending packet {1}",
|
// "[CLIENT]: In {0} sending packet {1}",
|
||||||
|
|
|
@ -345,8 +345,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
LLQueItem qpack = ResendOutgoingPacketQueue.Dequeue();
|
LLQueItem qpack = ResendOutgoingPacketQueue.Dequeue();
|
||||||
|
|
||||||
SendQueue.Enqueue(qpack);
|
SendQueue.Enqueue(qpack);
|
||||||
TotalThrottle.AddBytes(qpack.Length);
|
int qpackSize = qpack.Packet.ToBytes().Length;
|
||||||
ResendThrottle.AddBytes(qpack.Length);
|
TotalThrottle.AddBytes(qpackSize);
|
||||||
|
ResendThrottle.AddBytes(qpackSize);
|
||||||
|
|
||||||
qchanged = true;
|
qchanged = true;
|
||||||
}
|
}
|
||||||
|
@ -356,8 +357,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
LLQueItem qpack = LandOutgoingPacketQueue.Dequeue();
|
LLQueItem qpack = LandOutgoingPacketQueue.Dequeue();
|
||||||
|
|
||||||
SendQueue.Enqueue(qpack);
|
SendQueue.Enqueue(qpack);
|
||||||
TotalThrottle.AddBytes(qpack.Length);
|
int qpackSize = qpack.Packet.ToBytes().Length;
|
||||||
LandThrottle.AddBytes(qpack.Length);
|
TotalThrottle.AddBytes(qpackSize);
|
||||||
|
LandThrottle.AddBytes(qpackSize);
|
||||||
qchanged = true;
|
qchanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,8 +368,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
LLQueItem qpack = WindOutgoingPacketQueue.Dequeue();
|
LLQueItem qpack = WindOutgoingPacketQueue.Dequeue();
|
||||||
|
|
||||||
SendQueue.Enqueue(qpack);
|
SendQueue.Enqueue(qpack);
|
||||||
TotalThrottle.AddBytes(qpack.Length);
|
int qpackSize = qpack.Packet.ToBytes().Length;
|
||||||
WindThrottle.AddBytes(qpack.Length);
|
TotalThrottle.AddBytes(qpackSize);
|
||||||
|
WindThrottle.AddBytes(qpackSize);
|
||||||
qchanged = true;
|
qchanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,8 +379,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
LLQueItem qpack = CloudOutgoingPacketQueue.Dequeue();
|
LLQueItem qpack = CloudOutgoingPacketQueue.Dequeue();
|
||||||
|
|
||||||
SendQueue.Enqueue(qpack);
|
SendQueue.Enqueue(qpack);
|
||||||
TotalThrottle.AddBytes(qpack.Length);
|
int qpackSize = qpack.Packet.ToBytes().Length;
|
||||||
CloudThrottle.AddBytes(qpack.Length);
|
TotalThrottle.AddBytes(qpackSize);
|
||||||
|
CloudThrottle.AddBytes(qpackSize);
|
||||||
qchanged = true;
|
qchanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,8 +399,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
SendQueue.Enqueue(qpack);
|
SendQueue.Enqueue(qpack);
|
||||||
}
|
}
|
||||||
|
|
||||||
TotalThrottle.AddBytes(qpack.Length);
|
int qpackSize = qpack.Packet.ToBytes().Length;
|
||||||
TaskThrottle.AddBytes(qpack.Length);
|
TotalThrottle.AddBytes(qpackSize);
|
||||||
|
TaskThrottle.AddBytes(qpackSize);
|
||||||
qchanged = true;
|
qchanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -405,8 +410,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
LLQueItem qpack = TextureOutgoingPacketQueue.Dequeue();
|
LLQueItem qpack = TextureOutgoingPacketQueue.Dequeue();
|
||||||
|
|
||||||
SendQueue.Enqueue(qpack);
|
SendQueue.Enqueue(qpack);
|
||||||
TotalThrottle.AddBytes(qpack.Length);
|
int qpackSize = qpack.Packet.ToBytes().Length;
|
||||||
TextureThrottle.AddBytes(qpack.Length);
|
TotalThrottle.AddBytes(qpackSize);
|
||||||
|
TextureThrottle.AddBytes(qpackSize);
|
||||||
qchanged = true;
|
qchanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,8 +421,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
LLQueItem qpack = AssetOutgoingPacketQueue.Dequeue();
|
LLQueItem qpack = AssetOutgoingPacketQueue.Dequeue();
|
||||||
|
|
||||||
SendQueue.Enqueue(qpack);
|
SendQueue.Enqueue(qpack);
|
||||||
TotalThrottle.AddBytes(qpack.Length);
|
int qpackSize = qpack.Packet.ToBytes().Length;
|
||||||
AssetThrottle.AddBytes(qpack.Length);
|
TotalThrottle.AddBytes(qpackSize);
|
||||||
|
AssetThrottle.AddBytes(qpackSize);
|
||||||
qchanged = true;
|
qchanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -444,8 +451,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Monitor.Enter(this);
|
Monitor.Enter(this);
|
||||||
throttle.AddBytes(item.Length);
|
throttle.AddBytes(item.Packet.ToBytes().Length);
|
||||||
TotalThrottle.AddBytes(item.Length);
|
TotalThrottle.AddBytes(item.Packet.ToBytes().Length);
|
||||||
SendQueue.Enqueue(item);
|
SendQueue.Enqueue(item);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
|
@ -42,8 +42,5 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
public ThrottleOutPacketType throttleType;
|
public ThrottleOutPacketType throttleType;
|
||||||
public int TickCount;
|
public int TickCount;
|
||||||
public Object Identifier;
|
public Object Identifier;
|
||||||
public int Resends;
|
|
||||||
public Byte[] Bytes;
|
|
||||||
public int Length;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue