* 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); 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, public delegate void RezObject(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart,
UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
bool RezSelected, bool RemoveItem, UUID fromTaskID); 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, float height, float seconds, byte size, byte action, float north, float west, float south, float east,
UUID agentId); UUID agentId);
public delegate void NetworkStats(int inPackets, int outPackets, int unAckedBytes);
public delegate void SetAppearance(byte[] texture, List<byte> visualParamList); public delegate void SetAppearance(byte[] texture, List<byte> visualParamList);
public delegate void StartAnim(IClientAPI remoteClient, UUID animID); public delegate void StartAnim(IClientAPI remoteClient, UUID animID);
@ -722,6 +721,7 @@ namespace OpenSim.Framework
event StartLure OnStartLure; event StartLure OnStartLure;
event TeleportLureRequest OnTeleportLureRequest; event TeleportLureRequest OnTeleportLureRequest;
event NetworkStats OnNetworkStatsUpdate;
// void ActivateGesture(UUID assetId, UUID gestureId); // void ActivateGesture(UUID assetId, UUID gestureId);

View File

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

View File

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

View File

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

View File

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

View File

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