mirror of
https://github.com/opensim/opensim.git
synced 2026-07-31 05:45:37 +08:00
Changing Scene.ForEachClient to use the synchronous for loop instead of Parallel. This is quite possibly the source of some deadlocking, and at the very least the synchronous version gives better stack traces
* Lock the LLUDPClient RTO math * Add a helper function for backing off the RTO, and follow the optional advice in RFC 2988 to clear existing SRTT and RTTVAR values during a backoff * Removing the unused PrimitiveBaseShape.SculptImage parameter * Improved performance of SceneObjectPart instantiation * ZeroMesher now drops SculptData bytes like Meshmerizer, to allow the texture data to be GCed * Improved typecasting speed in MySQLLegacyRegionData.BuildShape() * Improved the instantiation of PrimitiveBaseShape
This commit is contained in:
@@ -144,6 +144,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
private readonly OutgoingPacket[] m_nextPackets = new OutgoingPacket[THROTTLE_CATEGORY_COUNT];
|
||||
/// <summary>A reference to the LLUDPServer that is managing this client</summary>
|
||||
private readonly LLUDPServer m_udpServer;
|
||||
/// <summary>Locks access to the variables used while calculating round-trip
|
||||
/// packet times and the retransmission timeout</summary>
|
||||
private readonly object m_roundTripCalcLock = new object();
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
@@ -484,28 +487,51 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
const float BETA = 0.25f;
|
||||
const float K = 4.0f;
|
||||
|
||||
if (RTTVAR == 0.0f)
|
||||
lock (m_roundTripCalcLock)
|
||||
{
|
||||
// First RTT measurement
|
||||
SRTT = r;
|
||||
RTTVAR = r * 0.5f;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Subsequence RTT measurement
|
||||
RTTVAR = (1.0f - BETA) * RTTVAR + BETA * Math.Abs(SRTT - r);
|
||||
SRTT = (1.0f - ALPHA) * SRTT + ALPHA * r;
|
||||
}
|
||||
if (RTTVAR == 0.0f)
|
||||
{
|
||||
// First RTT measurement
|
||||
SRTT = r;
|
||||
RTTVAR = r * 0.5f;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Subsequence RTT measurement
|
||||
RTTVAR = (1.0f - BETA) * RTTVAR + BETA * Math.Abs(SRTT - r);
|
||||
SRTT = (1.0f - ALPHA) * SRTT + ALPHA * r;
|
||||
}
|
||||
|
||||
RTO = (int)(SRTT + Math.Max(m_udpServer.TickCountResolution, K * RTTVAR));
|
||||
int rto = (int)(SRTT + Math.Max(m_udpServer.TickCountResolution, K * RTTVAR));
|
||||
|
||||
// Clamp the retransmission timeout to manageable values
|
||||
RTO = Utils.Clamp(RTO, 3000, 60000);
|
||||
// Clamp the retransmission timeout to manageable values
|
||||
rto = Utils.Clamp(RTO, 3000, 60000);
|
||||
|
||||
RTO = rto;
|
||||
}
|
||||
|
||||
//m_log.Debug("[LLUDPCLIENT]: Setting agent " + this.Agent.FullName + "'s RTO to " + RTO + "ms with an RTTVAR of " +
|
||||
// RTTVAR + " based on new RTT of " + r + "ms");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Exponential backoff of the retransmission timeout, per section 5.5
|
||||
/// of RFC 2988
|
||||
/// </summary>
|
||||
public void BackoffRTO()
|
||||
{
|
||||
lock (m_roundTripCalcLock)
|
||||
{
|
||||
// Reset SRTT and RTTVAR, we assume they are bogus since things
|
||||
// didn't work out and we're backing off the timeout
|
||||
SRTT = 0.0f;
|
||||
RTTVAR = 0.0f;
|
||||
|
||||
// Double the retransmission timeout
|
||||
RTO = Math.Min(RTO * 2, 60000);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Does an early check to see if this queue empty callback is already
|
||||
/// running, then asynchronously firing the event
|
||||
|
||||
@@ -431,8 +431,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
m_log.Debug("[LLUDPSERVER]: Resending " + expiredPackets.Count + " packets to " + udpClient.AgentID + ", RTO=" + udpClient.RTO);
|
||||
|
||||
// Backoff the RTO
|
||||
udpClient.RTO = Math.Min(udpClient.RTO * 2, 60000);
|
||||
// Exponential backoff of the retransmission timeout
|
||||
udpClient.BackoffRTO();
|
||||
|
||||
// Resend packets
|
||||
for (int i = 0; i < expiredPackets.Count; i++)
|
||||
|
||||
Reference in New Issue
Block a user