From 119104e35bc02e15a1ce08175ca6408fb8e9f7be Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sun, 21 Dec 2008 00:11:54 +0000 Subject: * 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. --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 16 +++++++++++++++- .../Region/Environment/Modules/World/NPC/NPCAvatar.cs | 1 + OpenSim/Region/Environment/Scenes/Scene.cs | 3 +++ OpenSim/Region/Environment/Scenes/SimStatsReporter.cs | 8 ++++++++ OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | 1 + 5 files changed, 28 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 5ce5235..9d8ecf0 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -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,7 +452,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_PacketHandler = new LLPacketHandler(this, m_networkServer, userSettings); m_PacketHandler.SynchronizeClient = SynchronizeClient; - + m_PacketHandler.OnPacketStats += PopulateStats; + RegisterLocalPacketHandlers(); m_clientThread = new Thread(Start); @@ -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) diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index 66662a0..6ca2bb4 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs @@ -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 diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 2b8ee74..5bc416f 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -2346,6 +2346,9 @@ namespace OpenSim.Region.Environment.Scenes client.OnSoundTrigger += soundModule.TriggerSound; client.OnObjectOwner += ObjectOwner; + + if (m_statsReporter != null) + client.OnNetworkStatsUpdate += m_statsReporter.AddPacketsFromClientStats; // EventManager.TriggerOnNewClient(client); } diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs index 70287fc..c614f78 100644 --- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs @@ -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 } } diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 35b5233..4cd5187 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -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 -- cgit v1.1