From 6d3d985511a8e70624c3a06a042890002f223978 Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Thu, 15 Oct 2009 02:01:29 -0400 Subject: [PATCH 1/6] * Request from lkalif to have the Sim send a coarselocationupdate for each avatar in the sim, including yourself. * Apparently the LLClientView should have been doing this previously.. Also fixed the 'You' on the index block.. so the client doesn't display an extra green dot. * Thanks lkalif for bringing it to our attention. --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 7 +++++-- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 7 ++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 8487adc7f5..4b27fa26bd 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3289,11 +3289,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP new CoarseLocationUpdatePacket.IndexBlock(); loc.Location = new CoarseLocationUpdatePacket.LocationBlock[total]; loc.AgentData = new CoarseLocationUpdatePacket.AgentDataBlock[total]; - + int selfindex = -1; for (int i = 0; i < total; i++) { CoarseLocationUpdatePacket.LocationBlock lb = new CoarseLocationUpdatePacket.LocationBlock(); + lb.X = (byte)CoarseLocations[i].X; lb.Y = (byte)CoarseLocations[i].Y; @@ -3301,8 +3302,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP loc.Location[i] = lb; loc.AgentData[i] = new CoarseLocationUpdatePacket.AgentDataBlock(); loc.AgentData[i].AgentID = users[i]; + if (users[i] == AgentId) + selfindex = i; } - ib.You = -1; + ib.You = (short)selfindex; ib.Prey = -1; loc.Index = ib; loc.Header.Reliable = false; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2a06f9eb9a..646a4831ec 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2507,8 +2507,9 @@ namespace OpenSim.Region.Framework.Scenes List avatars = m_scene.GetAvatars(); for (int i = 0; i < avatars.Count; i++) { - if (avatars[i] != this) - { + // Requested by LibOMV. Send Course Location on self. + //if (avatars[i] != this) + //{ if (avatars[i].ParentID != 0) { // sitting avatar @@ -2530,7 +2531,7 @@ namespace OpenSim.Region.Framework.Scenes CoarseLocations.Add(avatars[i].m_pos); AvatarUUIDs.Add(avatars[i].UUID); } - } + //} } m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations); From 9ddf598e543c7a72241d3194c448fc484bcb3fe2 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 15 Oct 2009 18:54:05 +0100 Subject: [PATCH 2/6] minor: Change commented out authentication service realm setting to "users" to match defaults in code --- bin/OpenSim.Server.ini.example | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/OpenSim.Server.ini.example b/bin/OpenSim.Server.ini.example index 635ba1ebec..f3d222f446 100644 --- a/bin/OpenSim.Server.ini.example +++ b/bin/OpenSim.Server.ini.example @@ -58,7 +58,7 @@ LocalServiceModule = "OpenSim.Services.FreeswitchService.dll:FreeswitchService" AuthenticationServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" StorageProvider = "OpenSim.Data.MySQL.dll" ConnectionString = "Data Source=localhost;Database=grid;User ID=grid;Password=grid;" -; Realm = "auth" +; Realm = "users" ; * This is the new style user service. ; * "Realm" is the table that is used for user lookup. @@ -75,7 +75,7 @@ ConnectionString = "Data Source=localhost;Database=grid;User ID=grid;Password=gr ; * It defaults to "regions", which uses the legacy tables ; * [GridService] - LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" - StorageProvider = "OpenSim.Data.MySQL.dll:MySqlRegionData" - ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=grid;" - Realm = "regions" +LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" +StorageProvider = "OpenSim.Data.MySQL.dll:MySqlRegionData" +ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=grid;" +Realm = "regions" From ac2f98b846eba85ab3d9acb5bd0f355a404de86c Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Fri, 16 Oct 2009 03:32:30 -0400 Subject: [PATCH 3/6] * A hacky attempt at resolving mantis #4260. I think ODE was unable to allocate memory, and therefore the unmanaged wrapper call fails or worse.. there's some unmanaged resource accounting in the ODEPlugin for ODECharacter that isn't being done properly now. * The broken avatar may not be able to move, but it won't stop simulate from pressing on now. And, the simulator will try to destroy the avatar's physics proxy and recreate it again... but if this is what I think it is, it may not help. --- .../Region/Framework/Scenes/ScenePresence.cs | 9 +++++++ .../Region/Physics/OdePlugin/ODECharacter.cs | 24 +++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 646a4831ec..96fa4679b4 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3410,11 +3410,20 @@ namespace OpenSim.Region.Framework.Scenes scene.AddPhysicsActorTaint(m_physicsActor); //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; + m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong m_physicsActor.SubscribeEvents(500); m_physicsActor.LocalID = LocalId; } + private void OutOfBoundsCall(PhysicsVector pos) + { + bool flying = m_physicsActor.Flying; + RemoveFromPhysicalScene(); + + AddToPhysicalScene(flying); + } + // Event called by the physics plugin to tell the avatar about a collision. private void PhysicsCollisionUpdate(EventArgs e) { diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index bd81d50f39..bd05c9209b 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -1105,7 +1105,18 @@ namespace OpenSim.Region.Physics.OdePlugin public void UpdatePositionAndVelocity() { // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! - d.Vector3 vec = d.BodyGetPosition(Body); + d.Vector3 vec; + try + { + vec = d.BodyGetPosition(Body); + //throw new NullReferenceException("foo!"); + } + catch (NullReferenceException) + { + vec = new d.Vector3(Position.X, Position.Y, Position.Z); + base.RaiseOutOfBounds(_position); + } + // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) if (vec.X < 0.0f) vec.X = 0.0f; @@ -1137,7 +1148,16 @@ namespace OpenSim.Region.Physics.OdePlugin else { m_lastUpdateSent = false; - vec = d.BodyGetLinearVel(Body); + try + { + vec = d.BodyGetLinearVel(Body); + } + catch (NullReferenceException) + { + vec.X = _velocity.X; + vec.Y = _velocity.Y; + vec.Z = _velocity.Z; + } _velocity.X = (vec.X); _velocity.Y = (vec.Y); From 1f28c6208be1b3be1acca69f0ac8056d0ceecc06 Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Fri, 16 Oct 2009 03:40:44 -0400 Subject: [PATCH 4/6] * Added a message for when the null reference exception occurs to make debugging easier. Without this, from the user's perspective.. they cannot move, fly or otherwise do anything physical and without a message on the console, it would be hard to tell that this is what is occurring. --- OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index bd05c9209b..e5458d4156 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -1109,12 +1109,13 @@ namespace OpenSim.Region.Physics.OdePlugin try { vec = d.BodyGetPosition(Body); - //throw new NullReferenceException("foo!"); + } catch (NullReferenceException) { - vec = new d.Vector3(Position.X, Position.Y, Position.Z); - base.RaiseOutOfBounds(_position); + vec = new d.Vector3(_position.X, _position.Y, _position.Z); + base.RaiseOutOfBounds(_position); // Tells ScenePresence that there's a problem! + m_log.WarnFormat("[ODEPLUGIN]: Avatar Null reference for Avatar: {0}", m_name); } From 67afa9e633b6b5c9c8be8f50eeecc5177c05119b Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Fri, 16 Oct 2009 03:52:57 -0400 Subject: [PATCH 5/6] * Make sure to unregister the OutOfBounds Physics event in RemoveFromPhysicalScene or we'll be leaking --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 96fa4679b4..b468dde10f 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -908,6 +908,7 @@ namespace OpenSim.Region.Framework.Scenes if (PhysicsActor != null) { m_physicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; + m_physicsActor.OnOutOfBounds -= OutOfBoundsCall; m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); m_physicsActor.UnSubscribeEvents(); m_physicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; From 0487092d15e6e456d8516bd7ae2487809c50ffc6 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 16 Oct 2009 13:28:40 +0100 Subject: [PATCH 6/6] Thank you, Fly man, for plumbing the AvatarInterestsUpdate packet --- .../ClientStack/LindenUDP/LLClientView.cs | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 4b27fa26bd..05a2a63037 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -9969,11 +9969,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP Utils.BytesToString(avatarNotesUpdate.Data.Notes)); break; -// case PacketType.AvatarInterestsUpdate: -// AvatarInterestsUpdatePacket avatarInterestUpdate = -// (AvatarInterestsUpdatePacket)Pack; -// -// break; + case PacketType.AvatarInterestsUpdate: + AvatarInterestsUpdatePacket avatarInterestUpdate = + (AvatarInterestsUpdatePacket)Pack; + + #region Packet Session and User Check + if (m_checkPackets) + { + if (avatarInterestUpdate.AgentData.SessionID != SessionId || + avatarInterestUpdate.AgentData.AgentID != AgentId) + break; + } + #endregion + + AvatarInterestUpdate handlerAvatarInterestUpdate = OnAvatarInterestUpdate; + if (handlerAvatarInterestUpdate != null) + handlerAvatarInterestUpdate(this, + avatarInterestUpdate.PropertiesData.WantToMask, + Utils.BytesToString(avatarInterestUpdate.PropertiesData.WantToText), + avatarInterestUpdate.PropertiesData.SkillsMask, + Utils.BytesToString(avatarInterestUpdate.PropertiesData.SkillsText), + Utils.BytesToString(avatarInterestUpdate.PropertiesData.LanguagesText)); + break; case PacketType.PlacesQuery: PlacesQueryPacket placesQueryPacket =