* Clarified what FireQueueEmpty is doing with a MIN_CALLBACK_MS constant and upped it to 30ms
* Removed the unused PacketSent() function * Switched UnackedPacketCollection from a SortedDictionary to a Dictionary now that the sorting is no longer needed. Big performance improvement for ResendUnacked()prioritization
parent
2b39ff0a39
commit
4e04f6b3a5
|
@ -531,11 +531,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
/// as an object to match the WaitCallback delegate signature</param>
|
||||
private void FireQueueEmpty(object o)
|
||||
{
|
||||
const int MIN_CALLBACK_MS = 30;
|
||||
|
||||
int i = (int)o;
|
||||
ThrottleOutPacketType type = (ThrottleOutPacketType)i;
|
||||
QueueEmpty callback = OnQueueEmpty;
|
||||
|
||||
int start = Environment.TickCount;
|
||||
int start = Environment.TickCount & Int32.MaxValue;
|
||||
|
||||
if (callback != null)
|
||||
{
|
||||
|
@ -543,10 +545,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
catch (Exception e) { m_log.Error("[LLUDPCLIENT]: OnQueueEmpty(" + type + ") threw an exception: " + e.Message, e); }
|
||||
}
|
||||
|
||||
// Make sure all queue empty calls take at least a measurable amount of time,
|
||||
// Make sure all queue empty calls take at least some amount of time,
|
||||
// otherwise we'll peg a CPU trying to fire these too fast
|
||||
if (Environment.TickCount == start)
|
||||
System.Threading.Thread.Sleep((int)m_udpServer.TickCountResolution);
|
||||
int elapsedMS = (Environment.TickCount & Int32.MaxValue) - start;
|
||||
if (elapsedMS < MIN_CALLBACK_MS)
|
||||
System.Threading.Thread.Sleep(MIN_CALLBACK_MS - elapsedMS);
|
||||
|
||||
m_onQueueEmptyRunning[i] = false;
|
||||
}
|
||||
|
|
|
@ -674,10 +674,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
packetInbox.Enqueue(new IncomingPacket(udpClient, packet));
|
||||
}
|
||||
|
||||
protected override void PacketSent(UDPPacketBuffer buffer, int bytesSent)
|
||||
{
|
||||
}
|
||||
|
||||
private void SendAckImmediate(IPEndPoint remoteEndpoint, uint sequenceNumber)
|
||||
{
|
||||
PacketAckPacket ack = new PacketAckPacket();
|
||||
|
|
|
@ -45,13 +45,6 @@ namespace OpenMetaverse
|
|||
/// </summary>
|
||||
/// <param name="buffer">Incoming packet buffer</param>
|
||||
protected abstract void PacketReceived(UDPPacketBuffer buffer);
|
||||
|
||||
/// <summary>
|
||||
/// This method is called when an outgoing packet is sent
|
||||
/// </summary>
|
||||
/// <param name="buffer">Outgoing packet buffer</param>
|
||||
/// <param name="bytesSent">Number of bytes written to the wire</param>
|
||||
protected abstract void PacketSent(UDPPacketBuffer buffer, int bytesSent);
|
||||
|
||||
/// <summary>UDP port to bind to in server mode</summary>
|
||||
protected int m_udpPort;
|
||||
|
@ -279,8 +272,6 @@ namespace OpenMetaverse
|
|||
{
|
||||
UDPPacketBuffer buf = (UDPPacketBuffer)result.AsyncState;
|
||||
int bytesSent = m_udpSocket.EndSendTo(result);
|
||||
|
||||
PacketSent(buf, bytesSent);
|
||||
}
|
||||
catch (SocketException) { }
|
||||
catch (ObjectDisposedException) { }
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
}
|
||||
|
||||
/// <summary>Holds the actual unacked packet data, sorted by sequence number</summary>
|
||||
private SortedDictionary<uint, OutgoingPacket> m_packets = new SortedDictionary<uint, OutgoingPacket>();
|
||||
private Dictionary<uint, OutgoingPacket> m_packets = new Dictionary<uint, OutgoingPacket>();
|
||||
/// <summary>Holds packets that need to be added to the unacknowledged list</summary>
|
||||
private LocklessQueue<OutgoingPacket> m_pendingAdds = new LocklessQueue<OutgoingPacket>();
|
||||
/// <summary>Holds information about pending acknowledgements</summary>
|
||||
|
|
Loading…
Reference in New Issue