* Re-implement packet tracking in IClientAPI so we can see what's going on in the client network in the simstats manager. This makes packets in per second, packets out per second, and unacked bytes work again in the simulator stats section.

0.6.2-post-fixes
Teravus Ovares 2008-12-21 00:11:54 +00:00
parent 3dae92b850
commit 119104e35b
7 changed files with 32 additions and 4 deletions

View File

@ -47,9 +47,6 @@ namespace OpenSim.Framework
public delegate void ImprovedInstantMessage(IClientAPI remoteclient, GridInstantMessage im);
// This shouldn't be cut down...
// especially if we're ever going to implement groups, presence, estate message dialogs...
public delegate void RezObject(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart,
UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
bool RezSelected, bool RemoveItem, UUID fromTaskID);
@ -63,6 +60,8 @@ namespace OpenSim.Framework
float height, float seconds, byte size, byte action, float north, float west, float south, float east,
UUID agentId);
public delegate void NetworkStats(int inPackets, int outPackets, int unAckedBytes);
public delegate void SetAppearance(byte[] texture, List<byte> visualParamList);
public delegate void StartAnim(IClientAPI remoteClient, UUID animID);
@ -722,6 +721,7 @@ namespace OpenSim.Framework
event StartLure OnStartLure;
event TeleportLureRequest OnTeleportLureRequest;
event NetworkStats OnNetworkStatsUpdate;
// void ActivateGesture(UUID assetId, UUID gestureId);

View File

@ -272,6 +272,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private StartLure handlerStartLure;
private TeleportLureRequest handlerTeleportLureRequest;
private NetworkStats handlerNetworkStatsUpdate;
private readonly IGroupsModule m_GroupsModule;
//private TerrainUnacked handlerUnackedTerrain = null;
@ -450,6 +452,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_PacketHandler = new LLPacketHandler(this, m_networkServer, userSettings);
m_PacketHandler.SynchronizeClient = SynchronizeClient;
m_PacketHandler.OnPacketStats += PopulateStats;
RegisterLocalPacketHandlers();
@ -572,6 +575,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void Terminate()
{
m_PacketHandler.OnPacketStats -= PopulateStats;
m_PacketHandler.Stop();
// wait for thread stoped
@ -585,6 +589,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
# region Packet Handling
public void PopulateStats(int inPackets, int outPackets, int unAckedBytes)
{
handlerNetworkStatsUpdate = OnNetworkStatsUpdate;
if (handlerNetworkStatsUpdate != null)
{
handlerNetworkStatsUpdate(inPackets, outPackets, unAckedBytes);
}
}
public static bool AddPacketHandler(PacketType packetType, PacketMethod handler)
{
bool result = false;
@ -1017,6 +1030,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public event StartLure OnStartLure;
public event TeleportLureRequest OnTeleportLureRequest;
public event NetworkStats OnNetworkStatsUpdate;
public void ActivateGesture(UUID assetId, UUID gestureId)

View File

@ -344,6 +344,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
public event StartLure OnStartLure;
public event TeleportLureRequest OnTeleportLureRequest;
public event NetworkStats OnNetworkStatsUpdate;
#pragma warning restore 67

View File

@ -2347,6 +2347,9 @@ namespace OpenSim.Region.Environment.Scenes
client.OnObjectOwner += ObjectOwner;
if (m_statsReporter != null)
client.OnNetworkStatsUpdate += m_statsReporter.AddPacketsFromClientStats;
// EventManager.TriggerOnNewClient(client);
}

View File

@ -409,6 +409,14 @@ namespace OpenSim.Region.Environment.Scenes
return lastReportedSimFPS;
}
public void AddPacketsFromClientStats(int inPackets, int outPackets, int unAckedBytes)
{
AddInPackets(inPackets);
AddOutPackets(outPackets);
AddunAckedBytes(unAckedBytes);
}
#endregion
}
}

View File

@ -239,6 +239,7 @@ namespace OpenSim.Region.Examples.SimpleModule
public event StartLure OnStartLure;
public event TeleportLureRequest OnTeleportLureRequest;
public event NetworkStats OnNetworkStatsUpdate;
#pragma warning restore 67

View File

@ -235,6 +235,7 @@ namespace OpenSim.Tests.Common.Mock
public event StartLure OnStartLure;
public event TeleportLureRequest OnTeleportLureRequest;
public event NetworkStats OnNetworkStatsUpdate;
#pragma warning restore 67