From fb096dfbd54cfbcfa60be872cee1680eb521dd14 Mon Sep 17 00:00:00 2001 From: MW Date: Mon, 21 Jul 2008 15:13:34 +0000 Subject: added experimental packet tracker (LLPacketTracker.cs), which can be told to track a packet and if it hasn't been acked within a set time, trigger a IClientAPI event, that the application/scene can handle. Currently only terrain packet tracking is finished, Tracking for initial Prim packets (first full update for a prim) is being worked on. Future improvements would be to make it a more generic packet tracker with callback delegates instead of events. Add a test event handler (which would fire after a minute if a terrain packet hadn't been acked) to scene to handle the OnUnackedTerrain event, which currently just resends the terrain patch. The idea of this packet tracking is for the region level application to be able to know if the client stack gave up on sending a packet. --- OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs | 9 +++++++-- OpenSim/Region/Environment/Scenes/Scene.cs | 9 +++++++++ OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index 040b9b7..574bc63 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs @@ -296,6 +296,8 @@ namespace OpenSim.Region.Environment.Modules.World.NPC public event GetScriptRunning OnGetScriptRunning; public event SetScriptRunning OnSetScriptRunning; public event UpdateVector OnAutoPilotGo; + + public event TerrainUnacked OnUnackedTerrain; #pragma warning restore 67 #endregion @@ -438,6 +440,9 @@ namespace OpenSim.Region.Environment.Modules.World.NPC public virtual void SendLayerData(int px, int py, float[] map) { } + public virtual void SendLayerData(int px, int py, float[] map, bool track) + { + } public virtual void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look) { @@ -513,7 +518,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC LLVector3 acc, LLQuaternion rotation, LLVector3 rvel, uint flags, LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, - byte[] particleSystem, byte clickAction) + byte[] particleSystem, byte clickAction, bool track) { } public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, @@ -522,7 +527,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, byte clickAction, byte[] textureanimation, - bool attachment, uint AttachmentPoint, LLUUID AssetId, LLUUID SoundId, double SoundVolume, byte SoundFlags, double SoundRadius) + bool attachment, uint AttachmentPoint, LLUUID AssetId, LLUUID SoundId, double SoundVolume, byte SoundFlags, double SoundRadius, bool track) { } public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index f602e9f..c2398b6 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -2084,6 +2084,8 @@ namespace OpenSim.Region.Environment.Scenes client.OnGetScriptRunning += GetScriptRunning; client.OnSetScriptRunning += SetScriptRunning; + client.OnUnackedTerrain += TerrainUnAcked; + // EventManager.TriggerOnNewClient(client); } @@ -3703,5 +3705,12 @@ namespace OpenSim.Region.Environment.Scenes // client.SendParcelMediaCommand((uint)(4), ParcelMediaCommandEnum.Play, 0); // }); } + + + public void TerrainUnAcked(IClientAPI client, int patchX, int patchY) + { + //Console.WriteLine("Terrain packet unacked, resending patch: " + patchX + " , " + patchY); + client.SendLayerData(patchX, patchY, Heightmap.GetFloatsSerialised()); + } } } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 156310b..253a83e 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -2085,7 +2085,7 @@ namespace OpenSim.Region.Environment.Scenes remoteClient.SendPrimitiveToClient(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, m_shape, lPos, Velocity, Acceleration, RotationOffset, RotationalVelocity, clientFlags, m_uuid, _ownerID, m_text, color, _parentID, m_particleSystem, m_clickAction, m_TextureAnimation, m_IsAttachment, - m_attachmentPoint,fromAssetID, Sound, SoundGain, SoundFlags, SoundRadius); + m_attachmentPoint,fromAssetID, Sound, SoundGain, SoundFlags, SoundRadius, false); } /// -- cgit v1.1