add a estimator of client ping time, and painfully make it visible in show
connections console commandavinationmerge
parent
d64fb216d2
commit
8c657e4837
|
@ -755,6 +755,8 @@ namespace OpenSim.Framework
|
|||
/// </summary>
|
||||
bool IsActive { get; set; }
|
||||
|
||||
int PingTimeMS { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Set if the client is closing due to a logout request
|
||||
/// </summary>
|
||||
|
|
|
@ -978,6 +978,7 @@ namespace OpenSim
|
|||
cdt.AddColumn("Circuit code", 12);
|
||||
cdt.AddColumn("Endpoint", 23);
|
||||
cdt.AddColumn("Active?", 7);
|
||||
cdt.AddColumn("ping(ms)", 8);
|
||||
|
||||
SceneManager.ForEachScene(
|
||||
s => s.ForEachClient(
|
||||
|
@ -986,7 +987,8 @@ namespace OpenSim
|
|||
c.Name,
|
||||
c.CircuitCode.ToString(),
|
||||
c.RemoteEndPoint.ToString(),
|
||||
c.IsActive.ToString())));
|
||||
c.IsActive.ToString(),
|
||||
c.PingTimeMS)));
|
||||
|
||||
MainConsole.Instance.Output(cdt.ToString());
|
||||
}
|
||||
|
|
|
@ -419,6 +419,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } }
|
||||
public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); }
|
||||
|
||||
public int PingTimeMS
|
||||
{
|
||||
get
|
||||
{
|
||||
if (UDPClient != null)
|
||||
return UDPClient.PingTimeMS;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Entity update queues
|
||||
/// </summary>
|
||||
|
@ -461,6 +471,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
set { m_disableFacelights = value; }
|
||||
}
|
||||
|
||||
|
||||
public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } }
|
||||
|
||||
|
||||
|
@ -1638,6 +1649,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
pc.PingID.OldestUnacked = 0;
|
||||
|
||||
OutPacket(pc, ThrottleOutPacketType.Unknown);
|
||||
UDPClient.m_lastStartpingTimeMS = Util.EnvironmentTickCount();
|
||||
}
|
||||
|
||||
public void SendKillObject(List<uint> localIDs)
|
||||
|
|
|
@ -163,6 +163,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
private int m_maxRTO = 60000;
|
||||
public bool m_deliverPackets = true;
|
||||
|
||||
public int m_lastStartpingTimeMS;
|
||||
public int m_pingMS;
|
||||
|
||||
public int PingTimeMS
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_pingMS < 20)
|
||||
return 20;
|
||||
if(m_pingMS > 2000)
|
||||
return 2000;
|
||||
return m_pingMS;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is the percentage of the udp texture queue to add to the task queue since
|
||||
/// textures are now generally handled through http.
|
||||
|
@ -225,6 +240,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
// Initialize this to a sane value to prevent early disconnects
|
||||
TickLastPacketReceived = Environment.TickCount & Int32.MaxValue;
|
||||
m_pingMS = (int)(3.0 * server.TickCountResolution); // so filter doesnt start at 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -293,6 +293,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
/// <summary>Flag to signal when clients should send pings</summary>
|
||||
protected bool m_sendPing;
|
||||
|
||||
|
||||
private ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>();
|
||||
|
||||
/// <summary>
|
||||
|
@ -369,16 +370,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
// Measure the resolution of Environment.TickCount
|
||||
TickCountResolution = 0f;
|
||||
for (int i = 0; i < 5; i++)
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
int start = Environment.TickCount;
|
||||
int now = start;
|
||||
while (now == start)
|
||||
now = Environment.TickCount;
|
||||
TickCountResolution += (float)(now - start) * 0.2f;
|
||||
TickCountResolution += (float)(now - start) * 0.1f;
|
||||
}
|
||||
m_log.Info("[LLUDPSERVER]: Average Environment.TickCount resolution: " + TickCountResolution + "ms");
|
||||
TickCountResolution = (float)Math.Ceiling(TickCountResolution);
|
||||
m_log.Info("[LLUDPSERVER]: Average Environment.TickCount resolution: " + TickCountResolution + "ms");
|
||||
|
||||
#endregion Environment.TickCount Measurement
|
||||
|
||||
|
@ -386,6 +387,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
int sceneThrottleBps = 0;
|
||||
bool usePools = false;
|
||||
|
||||
|
||||
|
||||
IConfig config = configSource.Configs["ClientStack.LindenUDP"];
|
||||
if (config != null)
|
||||
{
|
||||
|
@ -1128,6 +1131,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
pc.PingID.OldestUnacked = 0;
|
||||
|
||||
SendPacket(udpClient, pc, ThrottleOutPacketType.Unknown, false, null);
|
||||
udpClient.m_lastStartpingTimeMS = Util.EnvironmentTickCount();
|
||||
}
|
||||
|
||||
public void CompletePing(LLUDPClient udpClient, byte pingID)
|
||||
|
@ -1577,7 +1581,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
}
|
||||
else if (packet.Type == PacketType.CompletePingCheck)
|
||||
{
|
||||
// We don't currently track client ping times
|
||||
int t = Util.EnvironmentTickCountSubtract(udpClient.m_lastStartpingTimeMS);
|
||||
int c = udpClient.m_pingMS;
|
||||
c = 900 * c + 100 * t;
|
||||
c /= 1000;
|
||||
udpClient.m_pingMS = c;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,8 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
|||
|
||||
public ISceneAgent SceneAgent { get; set; }
|
||||
|
||||
public int PingTimeMS { get { return 0; } }
|
||||
|
||||
private string m_username;
|
||||
private string m_nick;
|
||||
|
||||
|
|
|
@ -81,6 +81,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
|||
get { return m_scene; }
|
||||
}
|
||||
|
||||
public int PingTimeMS { get { return 0; } }
|
||||
|
||||
public UUID OwnerID
|
||||
{
|
||||
get { return m_ownerID; }
|
||||
|
|
|
@ -379,6 +379,8 @@ namespace OpenSim.Tests.Common.Mock
|
|||
get { return FirstName + " " + LastName; }
|
||||
}
|
||||
|
||||
public int PingTimeMS { get { return 0; } }
|
||||
|
||||
public bool IsActive
|
||||
{
|
||||
get { return true; }
|
||||
|
|
Loading…
Reference in New Issue