From 89632f3ea8c355e5e860eb787aa21f90e79762d8 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 14 Nov 2011 20:56:56 +0000
Subject: Add test for removing a friendship.
---
.../CoreModules/Avatar/Friends/FriendsModule.cs | 12 ++++-----
.../Avatar/Friends/Tests/FriendModuleTests.cs | 30 ++++++++++++++++++----
.../Region/Framework/Interfaces/IFriendsModule.cs | 11 ++++++++
3 files changed, 42 insertions(+), 11 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 7a2a46e..529d7cf 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -241,7 +241,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
client.OnInstantMessage += OnInstantMessage;
client.OnApproveFriendRequest += OnApproveFriendRequest;
client.OnDenyFriendRequest += OnDenyFriendRequest;
- client.OnTerminateFriendship += OnTerminateFriendship;
+ client.OnTerminateFriendship += (thisClient, agentID, exfriendID) => RemoveFriendship(thisClient, exfriendID);
client.OnGrantUserRights += OnGrantUserRights;
Util.FireAndForget(delegate { FetchFriendslist(client); });
@@ -635,10 +635,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
}
}
}
-
- private void OnTerminateFriendship(IClientAPI client, UUID agentID, UUID exfriendID)
+
+ public void RemoveFriendship(IClientAPI client, UUID exfriendID)
{
- if (!DeleteFriendship(agentID, exfriendID))
+ if (!DeleteFriendship(client.AgentId, exfriendID))
client.SendAlertMessage("Unable to terminate friendship on this sim.");
// Update local cache
@@ -661,9 +661,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (friendSession != null)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
- m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID);
+ m_FriendsSimConnector.FriendshipTerminated(region, client.AgentId, exfriendID);
}
- }
+ }
}
private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights)
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs
index c945dcf..682fbab 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs
@@ -71,12 +71,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
- Assert.That(((TestClient)sp.ControllingClient).OfflineNotificationsReceived.Count, Is.EqualTo(0));
- Assert.That(((TestClient)sp.ControllingClient).OnlineNotificationsReceived.Count, Is.EqualTo(0));
+ Assert.That(((TestClient)sp.ControllingClient).ReceivedOfflineNotifications.Count, Is.EqualTo(0));
+ Assert.That(((TestClient)sp.ControllingClient).ReceivedOnlineNotifications.Count, Is.EqualTo(0));
}
[Test]
- public void TestAddFriendWhileOnline()
+ public void TestAddFriendshipWhileOnline()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
@@ -91,8 +91,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests
// notification.
m_fm.AddFriendship(sp.ControllingClient, user2Id);
- Assert.That(((TestClient)sp.ControllingClient).OfflineNotificationsReceived.Count, Is.EqualTo(0));
- Assert.That(((TestClient)sp.ControllingClient).OnlineNotificationsReceived.Count, Is.EqualTo(1));
+ Assert.That(((TestClient)sp.ControllingClient).ReceivedOfflineNotifications.Count, Is.EqualTo(0));
+ Assert.That(((TestClient)sp.ControllingClient).ReceivedOnlineNotifications.Count, Is.EqualTo(1));
+ }
+
+ [Test]
+ public void TestRemoveFriendshipWhileOnline()
+ {
+ TestHelpers.InMethod();
+// log4net.Config.XmlConfigurator.Configure();
+
+ UUID user1Id = TestHelpers.ParseTail(0x1);
+ UUID user2Id = TestHelpers.ParseTail(0x2);
+
+ ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, user1Id);
+ SceneHelpers.AddScenePresence(m_scene, user2Id);
+
+ m_fm.AddFriendship(sp.ControllingClient, user2Id);
+ m_fm.RemoveFriendship(sp.ControllingClient, user2Id);
+
+ TestClient user1Client = sp.ControllingClient as TestClient;
+ Assert.That(user1Client.ReceivedFriendshipTerminations.Count, Is.EqualTo(1));
+ Assert.That(user1Client.ReceivedFriendshipTerminations[0], Is.EqualTo(user2Id));
}
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs b/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs
index fdede34..061799e 100644
--- a/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs
@@ -44,6 +44,17 @@ namespace OpenSim.Region.Framework.Interfaces
///
void AddFriendship(IClientAPI client, UUID friendID);
+ ///
+ /// Remove a friendship between two users.
+ ///
+ ///
+ /// Ultimately, it would be more useful to take in a user account here rather than having to have a user
+ /// present in the scene.
+ ///
+ ///
+ ///
+ void RemoveFriendship(IClientAPI client, UUID exFriendID);
+
uint GetFriendPerms(UUID PrincipalID, UUID FriendID);
bool SendFriendsOnlineIfNeeded(IClientAPI client);
}
--
cgit v1.1
From 8d0aaa359fc47b7f9f46b1664f4e542dc6b578ef Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 15 Nov 2011 15:04:41 +0000
Subject: refactor: Don't create a new UUID for passing uuids to client - UUIDs
are structs are so not passed by reference (and they're immutable!)
---
OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 529d7cf..76d84ec 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -328,7 +328,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
List online = GetOnlineFriends(agentID);
if (online.Count > 0)
{
- m_log.DebugFormat("[FRIENDS MODULE]: User {0} in region {1} has {2} friends online", client.AgentId, client.Scene.RegionInfo.RegionName, online.Count);
+ m_log.DebugFormat(
+ "[FRIENDS MODULE]: User {0} in region {1} has {2} friends online",
+ client.Name, client.Scene.RegionInfo.RegionName, online.Count);
+
client.SendAgentOnline(online.ToArray());
}
@@ -806,16 +809,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (onlineBitChanged)
{
if ((rights & (int)FriendRights.CanSeeOnline) == 1)
- friendClient.SendAgentOnline(new UUID[] { new UUID(userID) });
+ friendClient.SendAgentOnline(new UUID[] { userID });
else
- friendClient.SendAgentOffline(new UUID[] { new UUID(userID) });
+ friendClient.SendAgentOffline(new UUID[] { userID });
}
else
{
bool canEditObjectsChanged = ((rights ^ userFlags) & (int)FriendRights.CanModifyObjects) != 0;
if (canEditObjectsChanged)
friendClient.SendChangeUserRights(userID, friendID, rights);
-
}
// Update local cache
--
cgit v1.1
From 50803dfe2ca8818f438d740e788762e1faf1078c Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 15 Nov 2011 15:57:53 +0000
Subject: For clients that are entering a simulator from initial login, stop
executing FriendsModule.FetchFriendslist() asychronously.
Executing this asynchronously allows a race condition where subsequent friends fetches hit a cache that FetchFriendsList() had not yet populated.
Changing this to synchronous may improve issues where a user does not see friends as online even though they are.
I don't believe synchronous is a problem here, but if it is, then a more complicated signalling mechanism is required. Locking the cache isn't sufficient.
---
.../CoreModules/Avatar/Friends/FriendsModule.cs | 32 ++++++++++++++++++----
.../World/Permissions/PermissionsModule.cs | 3 +-
OpenSim/Region/Framework/Scenes/EventManager.cs | 10 ++++---
3 files changed, 34 insertions(+), 11 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 76d84ec..f84033b 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -79,9 +79,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
protected IFriendsService m_FriendsService = null;
protected FriendsSimConnector m_FriendsSimConnector;
- protected Dictionary m_Friends =
- new Dictionary();
+ ///
+ /// Cache friends lists for users.
+ ///
+ ///
+ /// This is a complex and error-prone thing to do. At the moment, we assume that the efficiency gained in
+ /// permissions checks outweighs the disadvantages of that complexity.
+ ///
+ protected Dictionary m_Friends = new Dictionary();
+ ///
+ /// Maintain a record of viewers that need to be sent notifications for friends that are online. This only
+ /// needs to be done on login. Subsequent online/offline friend changes are sent by a different mechanism.
+ ///
protected HashSet m_NeedsListOfFriends = new HashSet();
protected IPresenceService PresenceService
@@ -189,6 +199,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
{
if (!m_Enabled)
return;
+
m_log.DebugFormat("[FRIENDS MODULE]: AddRegion on {0}", Name);
m_Scenes.Add(scene);
@@ -244,12 +255,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
client.OnTerminateFriendship += (thisClient, agentID, exfriendID) => RemoveFriendship(thisClient, exfriendID);
client.OnGrantUserRights += OnGrantUserRights;
- Util.FireAndForget(delegate { FetchFriendslist(client); });
+ // Do not do this asynchronously. If we do, then subsequent code can outrace FetchFriendsList() and
+ // return misleading results from the still empty friends cache.
+ // If we absolutely need to do this asynchronously, then a signalling mechanism is needed so that calls
+ // to GetFriends() will wait until FetchFriendslist() completes. Locks are insufficient.
+ FetchFriendslist(client);
}
- /// Fetch the friends list or increment the refcount for the existing
- /// friends list
+
+ ///
+ /// Fetch the friends list or increment the refcount for the existing
+ /// friends list.
+ ///
+ ///
+ ///
+ ///
/// Returns true if the list was fetched, false if it wasn't
+ ///
protected virtual bool FetchFriendslist(IClientAPI client)
{
UUID agentID = client.AgentId;
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 3b661ed..f416f06 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -479,8 +479,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
}
protected bool IsFriendWithPerms(UUID user,UUID objectOwner)
- {
-
+ {
if (user == UUID.Zero)
return false;
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 96da2c3..bf9ad65 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -73,8 +73,10 @@ namespace OpenSim.Region.Framework.Scenes
///
public event OnNewClientDelegate OnNewClient;
- public delegate void OnClientLoginDelegate(IClientAPI client);
- public event OnClientLoginDelegate OnClientLogin;
+ ///
+ /// Fired if the client entering this sim is doing so as a new login
+ ///
+ public event Action OnClientLogin;
public delegate void OnNewPresenceDelegate(ScenePresence presence);
@@ -651,10 +653,10 @@ namespace OpenSim.Region.Framework.Scenes
public void TriggerOnClientLogin(IClientAPI client)
{
- OnClientLoginDelegate handlerClientLogin = OnClientLogin;
+ Action handlerClientLogin = OnClientLogin;
if (handlerClientLogin != null)
{
- foreach (OnClientLoginDelegate d in handlerClientLogin.GetInvocationList())
+ foreach (Action d in handlerClientLogin.GetInvocationList())
{
try
{
--
cgit v1.1
From 2b5b4ac167bf5d1383a816447cb2d42364246aa8 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 15 Nov 2011 16:05:08 +0000
Subject: refactor: rename m_NeedsListOfFriends => m_NeedsListOfOnlineFriends
to better reflect its actual function
---
OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index f84033b..d28ad0f 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -92,7 +92,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
/// Maintain a record of viewers that need to be sent notifications for friends that are online. This only
/// needs to be done on login. Subsequent online/offline friend changes are sent by a different mechanism.
///
- protected HashSet m_NeedsListOfFriends = new HashSet();
+ protected HashSet m_NeedsListOfOnlineFriends = new HashSet();
protected IPresenceService PresenceService
{
@@ -331,8 +331,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
StatusChange(agentID, true);
// Register that we need to send the list of online friends to this user
- lock (m_NeedsListOfFriends)
- m_NeedsListOfFriends.Add(agentID);
+ lock (m_NeedsListOfOnlineFriends)
+ m_NeedsListOfOnlineFriends.Add(agentID);
}
public virtual bool SendFriendsOnlineIfNeeded(IClientAPI client)
@@ -340,9 +340,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
UUID agentID = client.AgentId;
// Check if the online friends list is needed
- lock (m_NeedsListOfFriends)
+ lock (m_NeedsListOfOnlineFriends)
{
- if (!m_NeedsListOfFriends.Remove(agentID))
+ if (!m_NeedsListOfOnlineFriends.Remove(agentID))
return false;
}
--
cgit v1.1
From 430821d83722f94612cb165de1b88d6268c95e07 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 15 Nov 2011 16:12:35 +0000
Subject: Rename FetchFriendslist() -> CacheFriends() and RefetchFriends() ->
RecacheFriends() to reflect their intended function
---
.../CoreModules/Avatar/Friends/FriendsModule.cs | 23 +++++++++++-----------
.../CoreModules/Avatar/Friends/HGFriendsModule.cs | 5 ++---
2 files changed, 13 insertions(+), 15 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index d28ad0f..5721f33 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -255,24 +255,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
client.OnTerminateFriendship += (thisClient, agentID, exfriendID) => RemoveFriendship(thisClient, exfriendID);
client.OnGrantUserRights += OnGrantUserRights;
- // Do not do this asynchronously. If we do, then subsequent code can outrace FetchFriendsList() and
+ // Do not do this asynchronously. If we do, then subsequent code can outrace CacheFriends() and
// return misleading results from the still empty friends cache.
// If we absolutely need to do this asynchronously, then a signalling mechanism is needed so that calls
- // to GetFriends() will wait until FetchFriendslist() completes. Locks are insufficient.
- FetchFriendslist(client);
+ // to GetFriends() will wait until CacheFriends() completes. Locks are insufficient.
+ CacheFriends(client);
}
///
- /// Fetch the friends list or increment the refcount for the existing
- /// friends list.
+ /// Cache the friends list or increment the refcount for the existing friends list.
///
///
///
///
/// Returns true if the list was fetched, false if it wasn't
///
- protected virtual bool FetchFriendslist(IClientAPI client)
+ protected virtual bool CacheFriends(IClientAPI client)
{
UUID agentID = client.AgentId;
lock (m_Friends)
@@ -319,7 +318,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
private void OnMakeRootAgent(ScenePresence sp)
{
- RefetchFriends(sp.ControllingClient);
+ RecacheFriends(sp.ControllingClient);
}
private void OnClientLogin(IClientAPI client)
@@ -605,7 +604,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
StoreFriendships(client.AgentId, friendID);
// Update the local cache
- RefetchFriends(client);
+ RecacheFriends(client);
//
// Notify the friend
@@ -667,7 +666,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
client.SendAlertMessage("Unable to terminate friendship on this sim.");
// Update local cache
- RefetchFriends(client);
+ RecacheFriends(client);
client.SendTerminateFriend(exfriendID);
@@ -781,7 +780,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
friendClient.SendInstantMessage(im);
// Update the local cache
- RefetchFriends(friendClient);
+ RecacheFriends(friendClient);
// we're done
return true;
@@ -814,7 +813,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// the friend in this sim as root agent
friendClient.SendTerminateFriend(exfriendID);
// update local cache
- RefetchFriends(friendClient);
+ RecacheFriends(friendClient);
// we're done
return true;
}
@@ -913,7 +912,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
return FriendsService.GetFriends(client.AgentId);
}
- private void RefetchFriends(IClientAPI client)
+ private void RecacheFriends(IClientAPI client)
{
UUID agentID = client.AgentId;
lock (m_Friends)
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
index 02b417f..56bba75 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
@@ -30,7 +30,6 @@ using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Threading;
-
using log4net;
using Nini.Config;
using Nwc.XmlRpc;
@@ -84,9 +83,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
#endregion
- protected override bool FetchFriendslist(IClientAPI client)
+ protected override bool CacheFriends(IClientAPI client)
{
- if (base.FetchFriendslist(client))
+ if (base.CacheFriends(client))
{
UUID agentID = client.AgentId;
// we do this only for the root agent
--
cgit v1.1
From 64784bc0cf194a3fae0168dd5f2d6fadc8a9235d Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 15 Nov 2011 17:30:58 +0000
Subject: remove SceneCommunicationService.OnAvatarCrossingIntoRegion. This
stuff is not being used any more - it's now IEntityTransferModule and
SimulationService instead
---
OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 1 -
OpenSim/Region/Framework/Scenes/Scene.cs | 2 --
OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | 5 -----
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 9 ++++++---
4 files changed, 6 insertions(+), 11 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 5721f33..21640cf 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -262,7 +262,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
CacheFriends(client);
}
-
///
/// Cache the friends list or increment the refcount for the existing friends list.
///
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index ce5b493..781f922 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3200,7 +3200,6 @@ namespace OpenSim.Region.Framework.Scenes
///
public void RegisterCommsEvents()
{
- m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing;
m_sceneGridService.OnCloseAgentConnection += IncomingCloseAgent;
//m_eventManager.OnRegionUp += OtherRegionUp;
//m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
@@ -3218,7 +3217,6 @@ namespace OpenSim.Region.Framework.Scenes
//m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar;
//m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
//m_eventManager.OnRegionUp -= OtherRegionUp;
- m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing;
m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent;
m_sceneGridService.OnGetLandData -= GetLandData;
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index eccce89..ff45b1f 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -61,11 +61,6 @@ namespace OpenSim.Region.Framework.Scenes
protected List m_agentsInTransit;
///
- /// An agent is crossing into this region
- ///
- public event AgentCrossing OnAvatarCrossingIntoRegion;
-
- ///
/// A user will arrive shortly, set up appropriate credentials so it can connect
///
// public event ExpectUserDelegate OnExpectUser;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 098437a..189394e 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -859,9 +859,12 @@ namespace OpenSim.Region.Framework.Scenes
#region Status Methods
///
- /// This turns a child agent, into a root agent
- /// This is called when an agent teleports into a region, or if an
- /// agent crosses into this region from a neighbor over the border
+ /// Turns a child agent into a root agent.
+ ///
+ /// Child agents are logged into neighbouring sims largely to observe changes. Root agents exist when the
+ /// avatar is actual in the sim. They can perform all actions.
+ /// This change is made whenever an avatar enters a region, whether by crossing over from a neighbouring sim,
+ /// teleporting in or on initial login.
///
public void MakeRootAgent(Vector3 pos, bool isFlying)
{
--
cgit v1.1
From 20f26eeb17da708a58a26629e8e9b08a5e9a6950 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 15 Nov 2011 17:38:55 +0000
Subject: Remove unused RegionCommsListener/IRegionCommsListener.
All this is now being handled through IEntityTransferModule and SimulationService instead, and has been for some time.
---
OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | 3 ---
1 file changed, 3 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index ff45b1f..3d56f9b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -55,9 +55,6 @@ namespace OpenSim.Region.Framework.Scenes
protected RegionInfo m_regionInfo;
protected Scene m_scene;
-
- protected RegionCommsListener regionCommsHost;
-
protected List m_agentsInTransit;
///
--
cgit v1.1
From a3c5f76942270f17e359bfcf8f43c6db3d1f782d Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 15 Nov 2011 18:16:43 +0000
Subject: Removed unused and mostly commented out SceneCommunicationService
methods
As far as I can see, the SCS is only now used for informing neighbours of up/down status and possibly sending child agent updates and close requests
---
OpenSim/Region/Framework/Scenes/Scene.cs | 38 +---------
.../Framework/Scenes/SceneCommunicationService.cs | 81 +---------------------
2 files changed, 3 insertions(+), 116 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 781f922..fb4b545 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1121,8 +1121,8 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGraph.Close();
- // De-register with region communications (events cleanup)
- UnRegisterRegionWithComms();
+ if (!GridService.DeregisterRegion(m_regInfo.RegionID))
+ m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", m_regInfo.RegionName);
// call the base class Close method.
base.Close();
@@ -1623,8 +1623,6 @@ namespace OpenSim.Region.Framework.Scenes
/// Thrown if registration of the region itself fails.
public void RegisterRegionWithGrid()
{
- RegisterCommsEvents();
-
m_sceneGridService.SetScene(this);
GridRegion region = new GridRegion(RegionInfo);
@@ -3196,38 +3194,6 @@ namespace OpenSim.Region.Framework.Scenes
#region RegionComms
///
- /// Register the methods that should be invoked when this scene receives various incoming events
- ///
- public void RegisterCommsEvents()
- {
- m_sceneGridService.OnCloseAgentConnection += IncomingCloseAgent;
- //m_eventManager.OnRegionUp += OtherRegionUp;
- //m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
- //m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar;
- m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid;
- m_sceneGridService.OnGetLandData += GetLandData;
- }
-
- ///
- /// Deregister this scene from receiving incoming region events
- ///
- public void UnRegisterRegionWithComms()
- {
- m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid;
- //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar;
- //m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
- //m_eventManager.OnRegionUp -= OtherRegionUp;
- m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent;
- m_sceneGridService.OnGetLandData -= GetLandData;
-
- // this does nothing; should be removed
- m_sceneGridService.Close();
-
- if (!GridService.DeregisterRegion(m_regInfo.RegionID))
- m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", m_regInfo.RegionName);
- }
-
- ///
/// Do the work necessary to initiate a new user connection for a particular scene.
/// At the moment, this consists of setting up the caps infrastructure
/// The return bool should allow for connections to be refused, but as not all calling paths
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index 3d56f9b..0e22156 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -55,57 +55,6 @@ namespace OpenSim.Region.Framework.Scenes
protected RegionInfo m_regionInfo;
protected Scene m_scene;
- protected List m_agentsInTransit;
-
- ///
- /// A user will arrive shortly, set up appropriate credentials so it can connect
- ///
-// public event ExpectUserDelegate OnExpectUser;
-
- ///
- /// A Prim will arrive shortly
- ///
- public event CloseAgentConnection OnCloseAgentConnection;
-
- ///
- /// A new prim has arrived
- ///
-// public event PrimCrossing OnPrimCrossingIntoRegion;
-
- /////
- ///// A New Region is up and available
- /////
- //public event RegionUp OnRegionUp;
-
- ///
- /// We have a child agent for this avatar and we're getting a status update about it
- ///
-// public event ChildAgentUpdate OnChildAgentUpdate;
- //public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar;
-
- ///
- /// Time to log one of our users off. Grid Service sends this mostly
- ///
- public event LogOffUser OnLogOffUser;
-
- ///
- /// A region wants land data from us!
- ///
- public event GetLandData OnGetLandData;
-
-// private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion;
-// private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser;
-// private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection;
-// private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion;
- //private RegionUp handlerRegionUp = null; // OnRegionUp;
-// private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate;
- //private RemoveKnownRegionsFromAvatarList handlerRemoveKnownRegionFromAvatar = null; // OnRemoveKnownRegionFromAvatar;
-// private LogOffUser handlerLogOffUser = null;
-// private GetLandData handlerGetLandData = null; // OnGetLandData
-
- public SceneCommunicationService()
- {
- }
public void SetScene(Scene s)
{
@@ -113,23 +62,6 @@ namespace OpenSim.Region.Framework.Scenes
m_regionInfo = s.RegionInfo;
}
- ///
- /// Register a region with the grid
- ///
- ///
- /// Thrown if region registration fails.
- public void RegisterRegion(IInterregionCommsOut comms_out, RegionInfo regionInfos)
- {
- }
-
- ///
- /// This region is shutting down, de-register all events!
- /// De-Register region from Grid!
- ///
- public void Close()
- {
- }
-
public delegate void InformNeighbourThatRegionUpDelegate(INeighbourService nService, RegionInfo region, ulong regionhandle);
private void InformNeighborsThatRegionisUpCompleted(IAsyncResult iar)
@@ -165,7 +97,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
-
public void InformNeighborsThatRegionisUp(INeighbourService neighbourService, RegionInfo region)
{
//m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);
@@ -182,7 +113,6 @@ namespace OpenSim.Region.Framework.Scenes
}
public delegate void SendChildAgentDataUpdateDelegate(AgentPosition cAgentData, UUID scopeID, GridRegion dest);
-
///
/// This informs all neighboring regions about the settings of it's child agent.
@@ -247,19 +177,11 @@ namespace OpenSim.Region.Framework.Scenes
}
- //public delegate void SendCloseChildAgentDelegate(UUID agentID, ulong regionHandle);
- //private void SendCloseChildAgentCompleted(IAsyncResult iar)
- //{
- // SendCloseChildAgentDelegate icon = (SendCloseChildAgentDelegate)iar.AsyncState;
- // icon.EndInvoke(iar);
- //}
-
///
/// Closes a child agent on a given region
///
protected void SendCloseChildAgent(UUID agentID, ulong regionHandle)
{
-
m_log.Debug("[INTERGRID]: Sending close agent to " + regionHandle);
// let's do our best, but there's not much we can do if the neighbour doesn't accept.
@@ -291,6 +213,5 @@ namespace OpenSim.Region.Framework.Scenes
{
return m_scene.GridService.GetRegionsByName(UUID.Zero, name, maxNumber);
}
-
}
-}
+}
\ No newline at end of file
--
cgit v1.1
From 45c7789b54c4c04db908a0645ee58e7a285fcccd Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 15 Nov 2011 19:42:33 +0000
Subject: use a more efficient dictionary in OdeScene._collisionEventPrim
rather than a list
---
OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index c3279c6..a4e5c1e 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -221,7 +221,7 @@ namespace OpenSim.Region.Physics.OdePlugin
///
/// A list of actors that should receive collision events.
///
- private readonly List _collisionEventPrim = new List();
+ private readonly Dictionary _collisionEventPrim = new Dictionary();
private readonly HashSet _badCharacter = new HashSet();
public Dictionary geom_name_map = new Dictionary();
@@ -1636,10 +1636,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// m_log.DebugFormat("[PHYSICS]: Adding {0} to collision event reporting", obj.SOPName);
lock (_collisionEventPrim)
- {
- if (!_collisionEventPrim.Contains(obj))
- _collisionEventPrim.Add(obj);
- }
+ _collisionEventPrim[obj.LocalID] = obj;
}
///
@@ -1651,7 +1648,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// m_log.DebugFormat("[PHYSICS]: Removing {0} from collision event reporting", obj.SOPName);
lock (_collisionEventPrim)
- _collisionEventPrim.Remove(obj);
+ _collisionEventPrim.Remove(obj.LocalID);
}
#region Add/Remove Entities
@@ -2792,7 +2789,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
lock (_collisionEventPrim)
{
- foreach (PhysicsActor obj in _collisionEventPrim)
+ foreach (PhysicsActor obj in _collisionEventPrim.Values)
{
// m_log.DebugFormat("[PHYSICS]: Assessing {0} for collision events", obj.SOPName);
--
cgit v1.1
From e16d7fe1da3432d819f72e8c2af420601009854b Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 15 Nov 2011 20:02:09 +0000
Subject: Instead of having scene add/remove collision events directly to the
OdeScene collision event dictionary, marshall them via a change dictionary
first.
This is to avoid a complicated tri-thread deadlock on region crossing for avatars with attachments, where
1) XEngine starting up scripts can lock XEngine.m_Scripts and then try to lock OdeScene._collisionEventPrim while starting up a script due to avatar border crossing
2) An existing collision event will lock OdeScene._collisionEventPrim and then try to lock SP.m_attachments while trying to send the collision event to attachments
3) The avatar still entering the region will lock SP.m_attachments and then try to lock m_Scripts to start more attachment scripts.
---
OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 58 ++++++++++++++++++----------
1 file changed, 38 insertions(+), 20 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index a4e5c1e..740037f 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -219,9 +219,14 @@ namespace OpenSim.Region.Physics.OdePlugin
private readonly List _perloopContact = new List();
///
- /// A list of actors that should receive collision events.
+ /// A dictionary of actors that should receive collision events.
///
private readonly Dictionary _collisionEventPrim = new Dictionary();
+
+ ///
+ /// A dictionary of collision event changes that are waiting to be processed.
+ ///
+ private readonly Dictionary _collisionEventPrimChanges = new Dictionary();
private readonly HashSet _badCharacter = new HashSet();
public Dictionary geom_name_map = new Dictionary();
@@ -1635,8 +1640,8 @@ namespace OpenSim.Region.Physics.OdePlugin
{
// m_log.DebugFormat("[PHYSICS]: Adding {0} to collision event reporting", obj.SOPName);
- lock (_collisionEventPrim)
- _collisionEventPrim[obj.LocalID] = obj;
+ lock (_collisionEventPrimChanges)
+ _collisionEventPrimChanges[obj.LocalID] = obj;
}
///
@@ -1647,8 +1652,8 @@ namespace OpenSim.Region.Physics.OdePlugin
{
// m_log.DebugFormat("[PHYSICS]: Removing {0} from collision event reporting", obj.SOPName);
- lock (_collisionEventPrim)
- _collisionEventPrim.Remove(obj.LocalID);
+ lock (_collisionEventPrimChanges)
+ _collisionEventPrimChanges[obj.LocalID] = null;
}
#region Add/Remove Entities
@@ -2660,6 +2665,22 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
// m_physicsiterations = 10;
// }
+ // We change _collisionEventPrimChanges to avoid locking _collisionEventPrim itself and causing potential
+ // deadlock if the collision event tries to lock something else later on which is already locked by a
+ // caller that is adding or removing the collision event.
+ lock (_collisionEventPrimChanges)
+ {
+ foreach (KeyValuePair kvp in _collisionEventPrimChanges)
+ {
+ if (kvp.Value == null)
+ _collisionEventPrim.Remove(kvp.Key);
+ else
+ _collisionEventPrim[kvp.Key] = kvp.Value;
+ }
+
+ _collisionEventPrimChanges.Clear();
+ }
+
if (SupportsNINJAJoints)
{
DeleteRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks
@@ -2787,25 +2808,22 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
collision_optimized();
- lock (_collisionEventPrim)
+ foreach (PhysicsActor obj in _collisionEventPrim.Values)
{
- foreach (PhysicsActor obj in _collisionEventPrim.Values)
- {
// m_log.DebugFormat("[PHYSICS]: Assessing {0} for collision events", obj.SOPName);
- switch ((ActorTypes)obj.PhysicsActorType)
- {
- case ActorTypes.Agent:
- OdeCharacter cobj = (OdeCharacter)obj;
- cobj.AddCollisionFrameTime(100);
- cobj.SendCollisions();
- break;
+ switch ((ActorTypes)obj.PhysicsActorType)
+ {
+ case ActorTypes.Agent:
+ OdeCharacter cobj = (OdeCharacter)obj;
+ cobj.AddCollisionFrameTime(100);
+ cobj.SendCollisions();
+ break;
- case ActorTypes.Prim:
- OdePrim pobj = (OdePrim)obj;
- pobj.SendCollisions();
- break;
- }
+ case ActorTypes.Prim:
+ OdePrim pobj = (OdePrim)obj;
+ pobj.SendCollisions();
+ break;
}
}
--
cgit v1.1
From 828e4a5b093c6a67302776137fc0bdbcfded4c9b Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 15 Nov 2011 20:26:42 +0000
Subject: Add comments about trying to avoid synchronous work off the
EventManager.OnMakeRootAgent event since this is on the critical path for
transfer of avatars from one region to another.
---
OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 5 ++++-
OpenSim/Region/Framework/Scenes/EventManager.cs | 13 +++++++++----
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 3 +++
3 files changed, 16 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 21640cf..c266fe5 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -29,6 +29,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
+using System.Threading;
using log4net;
using Nini.Config;
using Nwc.XmlRpc;
@@ -856,7 +857,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
IClientAPI friendClient = LocateClientObject(friendID);
if (friendClient != null)
{
- // the friend in this sim as root agent
+ // the friend in this sim as root agent
if (online)
friendClient.SendAgentOnline(new UUID[] { userID });
else
@@ -913,6 +914,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
private void RecacheFriends(IClientAPI client)
{
+ // FIXME: Ideally, we want to avoid doing this here since it sits the EventManager.OnMakeRootAgent event
+ // is on the critical path for transferring an avatar from one region to another.
UUID agentID = client.AgentId;
lock (m_Friends)
{
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index bf9ad65..4906665 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -212,10 +212,15 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void OnMakeChildAgentDelegate(ScenePresence presence);
public event OnMakeChildAgentDelegate OnMakeChildAgent;
- public delegate void OnMakeRootAgentDelegate(ScenePresence presence);
public delegate void OnSaveNewWindlightProfileDelegate();
public delegate void OnSendNewWindlightProfileTargetedDelegate(RegionLightShareData wl, UUID user);
- public event OnMakeRootAgentDelegate OnMakeRootAgent;
+
+ ///
+ /// This event is on the critical path for transferring an avatar from one region to another. Try and do
+ /// as little work on this event as possible, or do work asynchronously.
+ ///
+ public event Action OnMakeRootAgent;
+
public event OnSendNewWindlightProfileTargetedDelegate OnSendNewWindlightProfileTargeted;
public event OnSaveNewWindlightProfileDelegate OnSaveNewWindlightProfile;
@@ -1322,10 +1327,10 @@ namespace OpenSim.Region.Framework.Scenes
public void TriggerOnMakeRootAgent(ScenePresence presence)
{
- OnMakeRootAgentDelegate handlerMakeRootAgent = OnMakeRootAgent;
+ Action handlerMakeRootAgent = OnMakeRootAgent;
if (handlerMakeRootAgent != null)
{
- foreach (OnMakeRootAgentDelegate d in handlerMakeRootAgent.GetInvocationList())
+ foreach (Action d in handlerMakeRootAgent.GetInvocationList())
{
try
{
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 189394e..5587073 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -865,6 +865,9 @@ namespace OpenSim.Region.Framework.Scenes
/// avatar is actual in the sim. They can perform all actions.
/// This change is made whenever an avatar enters a region, whether by crossing over from a neighbouring sim,
/// teleporting in or on initial login.
+ ///
+ /// This method is on the critical path for transferring an avatar from one region to another. Delay here
+ /// delays that crossing.
///
public void MakeRootAgent(Vector3 pos, bool isFlying)
{
--
cgit v1.1
From 122304317cff1218e786855073b857af8a85f65a Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 15 Nov 2011 22:14:31 +0000
Subject: temporarily increasing logging in HGFriendsModule for debugging
---
.../CoreModules/Avatar/Friends/HGFriendsModule.cs | 25 +++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
index 56bba75..75c0183 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
@@ -85,6 +85,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
protected override bool CacheFriends(IClientAPI client)
{
+ m_log.DebugFormat("[HGFRIENDS MODULE]: Entered CacheFriends for {0}", client.Name);
+
if (base.CacheFriends(client))
{
UUID agentID = client.AgentId;
@@ -109,14 +111,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
}
}
}
+
+ m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting CacheFriends for {0} since detected root agent", client.Name);
return true;
}
}
+
+ m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting CacheFriends for {0} since detected not root agent", client.Name);
return false;
}
public override bool SendFriendsOnlineIfNeeded(IClientAPI client)
{
+ m_log.DebugFormat("[HGFRIENDS MODULE]: Entering SendFriendsOnlineIfNeeded for {0}", client.Name);
+
if (base.SendFriendsOnlineIfNeeded(client))
{
AgentCircuitData aCircuit = ((Scene)client.Scene).AuthenticateHandler.GetAgentCircuitData(client.AgentId);
@@ -133,11 +141,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
}
}
}
+
+ m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting SendFriendsOnlineIfNeeded for {0}", client.Name);
return false;
}
protected override void GetOnlineFriends(UUID userID, List friendList, /*collector*/ List online)
{
+ m_log.DebugFormat("[HGFRIENDS MODULE]: Entering GetOnlineFriends for {0}", userID);
+
List fList = new List();
foreach (string s in friendList)
{
@@ -156,6 +168,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (UUID.TryParse(pi.UserID, out presenceID))
online.Add(presenceID);
}
+
+ m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting GetOnlineFriends for {0}", userID);
}
//protected override void GetOnlineFriends(UUID userID, List friendList, /*collector*/ List online)
@@ -245,6 +259,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
protected override void StatusNotify(List friendList, UUID userID, bool online)
{
+ m_log.DebugFormat("[HGFRIENDS MODULE]: Entering StatusNotify for {0}", userID);
+
// First, let's divide the friends on a per-domain basis
Dictionary> friendsPerDomain = new Dictionary>();
foreach (FriendInfo friend in friendList)
@@ -297,6 +313,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
}
}
}
+
+ m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting StatusNotify for {0}", userID);
}
protected override bool GetAgentInfo(UUID scopeID, string fid, out UUID agentID, out string first, out string last)
@@ -350,6 +368,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
protected override FriendInfo[] GetFriendsFromService(IClientAPI client)
{
+ m_log.DebugFormat("[HGFRIENDS MODULE]: Entering GetFriendsFromService for {0}", client.Name);
+
UserAccount account1 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, client.AgentId);
if (account1 != null)
return base.GetFriendsFromService(client);
@@ -364,6 +384,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
finfos = FriendsService.GetFriends(agentUUI);
m_log.DebugFormat("[HGFRIENDS MODULE]: Fetched {0} local friends for visitor {1}", finfos.Length, agentUUI);
}
+
+ m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting GetFriendsFromService for {0}", client.Name);
+
return finfos;
}
@@ -626,4 +649,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
}
}
}
-}
+}
\ No newline at end of file
--
cgit v1.1
From 5b9fe4497df2aef7411a81517525fc2d7456420d Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 15 Nov 2011 23:12:41 +0000
Subject: Do proper locking of UserManagementModule.m_UserCache when getting.
This might help with
[USER AGENT CONNECTOR]: new connector to ()
[USER AGENT CONNECTOR]: Unable to contact remote server for GetServerURLs
[USER AGENT CONNECTOR]: Malformed Uri : Argument cannot be null.
Parameter name: uriString
---
.../UserManagement/UserManagementModule.cs | 86 ++++++++++++++--------
1 file changed, 57 insertions(+), 29 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index bef0d69..55279cc 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -130,7 +130,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
public void Close()
{
m_Scenes.Clear();
- m_UserCache.Clear();
+
+ lock (m_UserCache)
+ m_UserCache.Clear();
}
#endregion ISharedRegionModule
@@ -188,11 +190,14 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
{
string[] returnstring = new string[2];
- if (m_UserCache.ContainsKey(uuid))
+ lock (m_UserCache)
{
- returnstring[0] = m_UserCache[uuid].FirstName;
- returnstring[1] = m_UserCache[uuid].LastName;
- return returnstring;
+ if (m_UserCache.ContainsKey(uuid))
+ {
+ returnstring[0] = m_UserCache[uuid].FirstName;
+ returnstring[1] = m_UserCache[uuid].LastName;
+ return returnstring;
+ }
}
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(UUID.Zero, uuid);
@@ -237,22 +242,35 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
public string GetUserHomeURL(UUID userID)
{
- if (m_UserCache.ContainsKey(userID))
- return m_UserCache[userID].HomeURL;
+ lock (m_UserCache)
+ {
+ if (m_UserCache.ContainsKey(userID))
+ return m_UserCache[userID].HomeURL;
+ }
return string.Empty;
}
public string GetUserServerURL(UUID userID, string serverType)
{
- if (m_UserCache.ContainsKey(userID))
+ lock (m_UserCache)
+ m_UserCache.TryGetValue(userID, out userdata);
+
+ if (userdata != null)
{
- UserData userdata = m_UserCache[userID];
+// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Requested url type {0} for {1}", serverType, userID);
+
if (userdata.ServerURLs != null && userdata.ServerURLs.ContainsKey(serverType) && userdata.ServerURLs[serverType] != null)
+ {
return userdata.ServerURLs[serverType].ToString();
+ }
if (userdata.HomeURL != string.Empty)
{
+// m_log.DebugFormat(
+// "[USER MANAGEMENT MODULE]: Did not find url type {0} so requesting urls from {1} for {2}",
+// serverType, userdata.HomeURL, userID);
+
UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL);
userdata.ServerURLs = uConn.GetServerURLs(userID);
if (userdata.ServerURLs != null && userdata.ServerURLs.ContainsKey(serverType) && userdata.ServerURLs[serverType] != null)
@@ -269,9 +287,11 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
if (account != null)
return userID.ToString();
- if (m_UserCache.ContainsKey(userID))
+ lock (m_UserCache)
+ m_UserCache.TryGetValue(userID, out ud);
+
+ if (ud != null)
{
- UserData ud = m_UserCache[userID];
string homeURL = ud.HomeURL;
string first = ud.FirstName, last = ud.LastName;
if (ud.LastName.StartsWith("@"))
@@ -291,8 +311,11 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
public void AddUser(UUID uuid, string first, string last)
{
- if (m_UserCache.ContainsKey(uuid))
- return;
+ lock (m_UserCache)
+ {
+ if (m_UserCache.ContainsKey(uuid))
+ return;
+ }
UserData user = new UserData();
user.Id = uuid;
@@ -310,8 +333,11 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
public void AddUser(UUID id, string creatorData)
{
- if (m_UserCache.ContainsKey(id))
- return;
+ lock (m_UserCache)
+ {
+ if (m_UserCache.ContainsKey(id))
+ return;
+ }
// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, craetorData {1}", id, creatorData);
@@ -402,22 +428,24 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
private void HandleShowUsers(string module, string[] cmd)
{
- if (m_UserCache.Count == 0)
+ lock (m_UserCache)
{
- MainConsole.Instance.Output("No users not found");
+ if (m_UserCache.Count == 0)
+ {
+ MainConsole.Instance.Output("No users not found");
+ return;
+ }
+
+ MainConsole.Instance.Output("UUID User Name");
+ MainConsole.Instance.Output("-----------------------------------------------------------------------------");
+ foreach (KeyValuePair kvp in m_UserCache)
+ {
+ MainConsole.Instance.Output(String.Format("{0} {1} {2}",
+ kvp.Key, kvp.Value.FirstName, kvp.Value.LastName));
+ }
+
return;
}
-
- MainConsole.Instance.Output("UUID User Name");
- MainConsole.Instance.Output("-----------------------------------------------------------------------------");
- foreach (KeyValuePair kvp in m_UserCache)
- {
- MainConsole.Instance.Output(String.Format("{0} {1} {2}",
- kvp.Key, kvp.Value.FirstName, kvp.Value.LastName));
- }
- return;
}
-
-
}
-}
+}
\ No newline at end of file
--
cgit v1.1
From aea547cd11e4baa24cad12e13160e5ff2250a69f Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 15 Nov 2011 23:24:51 +0000
Subject: fix build break on UserManagementModule.
This also adds time since started to "show threads". Unfortunately these two changes got mixed in.
---
.../Framework/UserManagement/UserManagementModule.cs | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index 55279cc..cb500b9 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -31,7 +31,6 @@ using System.Reflection;
using OpenSim.Framework;
using OpenSim.Framework.Console;
-
using OpenSim.Region.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
@@ -44,13 +43,13 @@ using Nini.Config;
namespace OpenSim.Region.CoreModules.Framework.UserManagement
{
- struct UserData
+ class UserData
{
- public UUID Id;
- public string FirstName;
- public string LastName;
- public string HomeURL;
- public Dictionary ServerURLs;
+ public UUID Id { get; set; }
+ public string FirstName { get; set; }
+ public string LastName { get; set; }
+ public string HomeURL { get; set; }
+ public Dictionary ServerURLs { get; set; }
}
public class UserManagementModule : ISharedRegionModule, IUserManagement
@@ -253,6 +252,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
public string GetUserServerURL(UUID userID, string serverType)
{
+ UserData userdata;
lock (m_UserCache)
m_UserCache.TryGetValue(userID, out userdata);
@@ -287,6 +287,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
if (account != null)
return userID.ToString();
+ UserData ud;
lock (m_UserCache)
m_UserCache.TryGetValue(userID, out ud);
--
cgit v1.1
From 31ffd5450bab751f4df396b7d099367246b2f552 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 15 Nov 2011 23:34:28 +0000
Subject: Make tracked per scene thread names conform to the majorirty format.
This is ()
---
OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 9 ++++++---
OpenSim/Region/Framework/Scenes/Scene.cs | 4 +++-
2 files changed, 9 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index 00d7d55..95c727f 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -65,7 +65,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
private OpenSim.Framework.BlockingQueue requests = new OpenSim.Framework.BlockingQueue();
- //private IConfig m_config;
protected Scene m_scene;
private List cachedMapBlocks = new List();
private int cachedTime = 0;
@@ -348,7 +347,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
// m_log.Debug("[WORLD MAP]: Starting remote MapItem request thread");
- Watchdog.StartThread(process, "MapItemRequestThread", ThreadPriority.BelowNormal, true);
+ Watchdog.StartThread(
+ process,
+ string.Format("MapItemRequestThread ({0})", m_scene.RegionInfo.RegionName),
+ ThreadPriority.BelowNormal,
+ true);
}
///
@@ -357,7 +360,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
private void StopThread()
{
MapRequestState st = new MapRequestState();
- st.agentID=STOP_UUID;
+ st.agentID = STOP_UUID;
st.EstateID=0;
st.flags=0;
st.godlike=false;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index fb4b545..c1cbbd4 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1145,7 +1145,9 @@ namespace OpenSim.Region.Framework.Scenes
}
m_lastUpdate = Util.EnvironmentTickCount();
- HeartbeatThread = Watchdog.StartThread(Heartbeat, "Heartbeat for region " + RegionInfo.RegionName, ThreadPriority.Normal, false);
+ HeartbeatThread
+ = Watchdog.StartThread(
+ Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false);
}
///
--
cgit v1.1
From 92dff85afbfacaae0920b943053629ed8e563637 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 15 Nov 2011 23:38:24 +0000
Subject: Enable log message to tell us what type of url is being requested
from a user's homeurl
---
.../CoreModules/Framework/UserManagement/UserManagementModule.cs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index cb500b9..b982c85 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -267,9 +267,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
if (userdata.HomeURL != string.Empty)
{
-// m_log.DebugFormat(
-// "[USER MANAGEMENT MODULE]: Did not find url type {0} so requesting urls from {1} for {2}",
-// serverType, userdata.HomeURL, userID);
+ m_log.DebugFormat(
+ "[USER MANAGEMENT MODULE]: Did not find url type {0} so requesting urls from '{1}' for {2}",
+ serverType, userdata.HomeURL, userID);
UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL);
userdata.ServerURLs = uConn.GetServerURLs(userID);
--
cgit v1.1
From 33b1e385ec1ef494e8908be5d75920e62d0adb40 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 16 Nov 2011 00:01:21 +0000
Subject: Look up a homeURL only when it's not null, in addition to not being
string.Empty
---
.../Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index b982c85..83986e2 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -265,7 +265,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
return userdata.ServerURLs[serverType].ToString();
}
- if (userdata.HomeURL != string.Empty)
+ if (userData.HomeURL != null && userdata.HomeURL != string.Empty)
{
m_log.DebugFormat(
"[USER MANAGEMENT MODULE]: Did not find url type {0} so requesting urls from '{1}' for {2}",
--
cgit v1.1
From 9488b235d1a07f235381a1b8e0ee816fe2a27f54 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 16 Nov 2011 00:10:55 +0000
Subject: Fix the build break
---
.../Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index 83986e2..a40a6a4 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -265,7 +265,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
return userdata.ServerURLs[serverType].ToString();
}
- if (userData.HomeURL != null && userdata.HomeURL != string.Empty)
+ if (userdata.HomeURL != null && userdata.HomeURL != string.Empty)
{
m_log.DebugFormat(
"[USER MANAGEMENT MODULE]: Did not find url type {0} so requesting urls from '{1}' for {2}",
--
cgit v1.1
From e21949deaf00b409c16fca8ccf0ea9f27e8c1969 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 16 Nov 2011 00:26:54 +0000
Subject: Comment out the vebose logging on HGFriendsModule.
Recent issues in http://opensimulator.org/mantis/view.php?id=5794 were not related to HG friends
---
.../CoreModules/Avatar/Friends/HGFriendsModule.cs | 23 +++++++++++-----------
1 file changed, 11 insertions(+), 12 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
index 75c0183..9a97925 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
@@ -85,7 +85,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
protected override bool CacheFriends(IClientAPI client)
{
- m_log.DebugFormat("[HGFRIENDS MODULE]: Entered CacheFriends for {0}", client.Name);
+// m_log.DebugFormat("[HGFRIENDS MODULE]: Entered CacheFriends for {0}", client.Name);
if (base.CacheFriends(client))
{
@@ -112,18 +112,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
}
}
- m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting CacheFriends for {0} since detected root agent", client.Name);
+// m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting CacheFriends for {0} since detected root agent", client.Name);
return true;
}
}
- m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting CacheFriends for {0} since detected not root agent", client.Name);
+// m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting CacheFriends for {0} since detected not root agent", client.Name);
return false;
}
public override bool SendFriendsOnlineIfNeeded(IClientAPI client)
{
- m_log.DebugFormat("[HGFRIENDS MODULE]: Entering SendFriendsOnlineIfNeeded for {0}", client.Name);
+// m_log.DebugFormat("[HGFRIENDS MODULE]: Entering SendFriendsOnlineIfNeeded for {0}", client.Name);
if (base.SendFriendsOnlineIfNeeded(client))
{
@@ -142,13 +142,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
}
}
- m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting SendFriendsOnlineIfNeeded for {0}", client.Name);
+// m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting SendFriendsOnlineIfNeeded for {0}", client.Name);
return false;
}
protected override void GetOnlineFriends(UUID userID, List friendList, /*collector*/ List online)
{
- m_log.DebugFormat("[HGFRIENDS MODULE]: Entering GetOnlineFriends for {0}", userID);
+// m_log.DebugFormat("[HGFRIENDS MODULE]: Entering GetOnlineFriends for {0}", userID);
List fList = new List();
foreach (string s in friendList)
@@ -169,7 +169,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
online.Add(presenceID);
}
- m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting GetOnlineFriends for {0}", userID);
+// m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting GetOnlineFriends for {0}", userID);
}
//protected override void GetOnlineFriends(UUID userID, List friendList, /*collector*/ List online)
@@ -259,7 +259,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
protected override void StatusNotify(List friendList, UUID userID, bool online)
{
- m_log.DebugFormat("[HGFRIENDS MODULE]: Entering StatusNotify for {0}", userID);
+// m_log.DebugFormat("[HGFRIENDS MODULE]: Entering StatusNotify for {0}", userID);
// First, let's divide the friends on a per-domain basis
Dictionary> friendsPerDomain = new Dictionary>();
@@ -314,7 +314,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
}
}
- m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting StatusNotify for {0}", userID);
+// m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting StatusNotify for {0}", userID);
}
protected override bool GetAgentInfo(UUID scopeID, string fid, out UUID agentID, out string first, out string last)
@@ -368,7 +368,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
protected override FriendInfo[] GetFriendsFromService(IClientAPI client)
{
- m_log.DebugFormat("[HGFRIENDS MODULE]: Entering GetFriendsFromService for {0}", client.Name);
+// m_log.DebugFormat("[HGFRIENDS MODULE]: Entering GetFriendsFromService for {0}", client.Name);
UserAccount account1 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, client.AgentId);
if (account1 != null)
@@ -385,7 +385,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
m_log.DebugFormat("[HGFRIENDS MODULE]: Fetched {0} local friends for visitor {1}", finfos.Length, agentUUI);
}
- m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting GetFriendsFromService for {0}", client.Name);
+// m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting GetFriendsFromService for {0}", client.Name);
return finfos;
}
@@ -423,7 +423,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
}
return false;
-
}
protected override void StoreBackwards(UUID friendID, UUID agentID)
--
cgit v1.1
From baa65d4a15c0907434bb26f2ac85ad881dd3c3ca Mon Sep 17 00:00:00 2001
From: Dan Lake
Date: Tue, 15 Nov 2011 17:09:17 -0800
Subject: In AddNewClient, iterator over copy of entities rather than copying
under read lock
---
OpenSim/Region/Framework/Scenes/Scene.cs | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index c1cbbd4..f10789b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2544,11 +2544,12 @@ namespace OpenSim.Region.Framework.Scenes
// Send all scene object to the new client
Util.FireAndForget(delegate
{
- Entities.ForEach(delegate(EntityBase e)
+ EntityBase[] entities = Entities.GetEntities();
+ foreach(EntityBase e in entities)
{
if (e != null && e is SceneObjectGroup)
((SceneObjectGroup)e).SendFullUpdateToClient(client);
- });
+ }
});
}
--
cgit v1.1
From bd01c4a5cb40a2df02e9a3a9aee3db0829795f05 Mon Sep 17 00:00:00 2001
From: Dan Lake
Date: Wed, 16 Nov 2011 02:33:56 -0800
Subject: Call public ForEach instead of using m_entities directly. No semantic
changes, just cleanup
---
OpenSim/Region/Framework/Scenes/EntityManager.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/EntityManager.cs b/OpenSim/Region/Framework/Scenes/EntityManager.cs
index 1812bd2..b788a3c 100644
--- a/OpenSim/Region/Framework/Scenes/EntityManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EntityManager.cs
@@ -79,7 +79,7 @@ namespace OpenSim.Region.Framework.Scenes
{
List tmp = new List();
- m_entities.ForEach(
+ ForEach(
delegate(EntityBase entity)
{
if (entity is T)
@@ -93,7 +93,7 @@ namespace OpenSim.Region.Framework.Scenes
public EntityBase[] GetEntities()
{
List tmp = new List(m_entities.Count);
- m_entities.ForEach(delegate(EntityBase entity) { tmp.Add(entity); });
+ ForEach(delegate(EntityBase entity) { tmp.Add(entity); });
return tmp.ToArray();
}
--
cgit v1.1
From b6d83e9c0f4bd1d450e36270278285be50d5ace8 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 16 Nov 2011 23:01:59 +0000
Subject: Stop OdePrim and OdeCharacter insanely overriding set LocalID to set
their own private m_localID property but leaving get to return the then unset
PhysicsActor.LocalId!
Instead, just have both subclasses use the PhysicsActor.LocalID property.
This restores collision functionality that fell away in 45c7789 yesterday
---
OpenSim/Region/Framework/Scenes/EntityBase.cs | 6 ++++-
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 6 ++++-
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +-
OpenSim/Region/Physics/Manager/PhysicsActor.cs | 16 ++++++++-----
OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 6 -----
OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 11 +--------
.../Physics/OdePlugin/ODERayCastRequestManager.cs | 7 +++---
OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 28 ++++++++++------------
.../Region/Physics/OdePlugin/Tests/ODETestClass.cs | 2 +-
9 files changed, 40 insertions(+), 44 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/EntityBase.cs b/OpenSim/Region/Framework/Scenes/EntityBase.cs
index 664be01..741f53b 100644
--- a/OpenSim/Region/Framework/Scenes/EntityBase.cs
+++ b/OpenSim/Region/Framework/Scenes/EntityBase.cs
@@ -103,7 +103,11 @@ namespace OpenSim.Region.Framework.Scenes
public virtual uint LocalId
{
get { return m_localId; }
- set { m_localId = value; }
+ set
+ {
+ m_localId = value;
+// m_log.DebugFormat("[ENTITY BASE]: Set part {0} to local id {1}", Name, m_localId);
+ }
}
///
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index f693b36..4e79311 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -517,7 +517,11 @@ namespace OpenSim.Region.Framework.Scenes
public uint LocalId
{
get { return m_localId; }
- set { m_localId = value; }
+ set
+ {
+ m_localId = value;
+// m_log.DebugFormat("[SCENE OBJECT PART]: Set part {0} to local id {1}", Name, m_localId);
+ }
}
public virtual string Name
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 5587073..7d901c9 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -756,7 +756,7 @@ namespace OpenSim.Region.Framework.Scenes
m_name = String.Format("{0} {1}", Firstname, Lastname);
m_scene = world;
m_uuid = client.AgentId;
- m_localId = m_scene.AllocateLocalId();
+ LocalId = m_scene.AllocateLocalId();
UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid);
if (account != null)
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
index 49f60f8..798a0a4 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
@@ -25,8 +25,10 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+using log4net;
using System;
using System.Collections.Generic;
+using System.Reflection;
using OpenSim.Framework;
using OpenMetaverse;
@@ -46,10 +48,10 @@ namespace OpenSim.Region.Physics.Manager
public enum PIDHoverType
{
- Ground
- , GroundAndWater
- , Water
- , Absolute
+ Ground,
+ GroundAndWater,
+ Water,
+ Absolute
}
public struct ContactPoint
@@ -114,6 +116,8 @@ namespace OpenSim.Region.Physics.Manager
public abstract class PhysicsActor
{
+// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
public delegate void RequestTerseUpdate();
public delegate void CollisionUpdate(EventArgs e);
public delegate void OutOfBounds(Vector3 pos);
@@ -197,10 +201,10 @@ namespace OpenSim.Region.Physics.Manager
{
CollisionUpdate handler = OnCollisionUpdate;
+// m_log.DebugFormat("[PHYSICS ACTOR]: Sending collision for {0}", LocalID);
+
if (handler != null)
- {
handler(e);
- }
}
public virtual void SetMaterial (int material)
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 3630510..c37d588 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -108,7 +108,6 @@ namespace OpenSim.Region.Physics.OdePlugin
///
private Vector3 m_taintForce;
- internal uint m_localID = 0;
// taints and their non-tainted counterparts
private bool m_isPhysical = false; // the current physical status
private bool m_tainted_isPhysical = false; // set when the physical status is tainted (false=not existing in physics engine, true=existing)
@@ -231,11 +230,6 @@ namespace OpenSim.Region.Physics.OdePlugin
set { m_alwaysRun = value; }
}
- public override uint LocalID
- {
- set { m_localID = value; }
- }
-
public override bool Grabbed
{
set { return; }
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 2f9a54b..1ba7ef7 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -142,8 +142,6 @@ namespace OpenSim.Region.Physics.OdePlugin
public bool m_taintselected { get; private set; }
public bool m_taintCollidesWater { get; private set; }
- public uint m_localID { get; private set; }
-
private bool m_taintforce = false;
private bool m_taintaddangularforce = false;
private Vector3 m_force;
@@ -290,13 +288,6 @@ namespace OpenSim.Region.Physics.OdePlugin
set { return; }
}
- public override uint LocalID
- {
- set {
- //m_log.Info("[PHYSICS]: Setting TrackerID: " + value);
- m_localID = value; }
- }
-
public override bool Grabbed
{
set { return; }
@@ -1058,7 +1049,7 @@ Console.WriteLine("ZProcessTaints for " + Name);
private void AddChildPrim(OdePrim prim)
{
//Console.WriteLine("AddChildPrim " + Name);
- if (this.m_localID != prim.m_localID)
+ if (LocalID != prim.LocalID)
{
if (Body == IntPtr.Zero)
{
diff --git a/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs b/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs
index 6c2bdde..8d7d3b3 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs
@@ -371,12 +371,13 @@ namespace OpenSim.Region.Physics.OdePlugin
// Loop over contacts, build results.
for (int i = 0; i < count; i++)
{
- if (p1 != null) {
+ if (p1 != null)
+ {
if (p1 is OdePrim)
{
ContactResult collisionresult = new ContactResult();
- collisionresult.ConsumerID = ((OdePrim)p1).m_localID;
+ collisionresult.ConsumerID = p1.LocalID;
collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z);
collisionresult.Depth = contacts[i].depth;
collisionresult.Normal = new Vector3(contacts[i].normal.X, contacts[i].normal.Y,
@@ -392,7 +393,7 @@ namespace OpenSim.Region.Physics.OdePlugin
{
ContactResult collisionresult = new ContactResult();
- collisionresult.ConsumerID = ((OdePrim)p2).m_localID;
+ collisionresult.ConsumerID = p2.LocalID;
collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z);
collisionresult.Depth = contacts[i].depth;
collisionresult.Normal = new Vector3(contacts[i].normal.X, contacts[i].normal.Y,
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index 740037f..43d852b 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -1306,8 +1306,8 @@ namespace OpenSim.Region.Physics.OdePlugin
{
case ActorTypes.Agent:
cc1 = (OdeCharacter)p1;
- obj2LocalID = cc1.m_localID;
- cc1.AddCollisionEvent(cc2.m_localID, contact);
+ obj2LocalID = cc1.LocalID;
+ cc1.AddCollisionEvent(cc2.LocalID, contact);
//ctype = (int)CollisionCategories.Character;
//if (cc1.CollidingObj)
@@ -1322,8 +1322,8 @@ namespace OpenSim.Region.Physics.OdePlugin
if (p1 is OdePrim)
{
cp1 = (OdePrim) p1;
- obj2LocalID = cp1.m_localID;
- cp1.AddCollisionEvent(cc2.m_localID, contact);
+ obj2LocalID = cp1.LocalID;
+ cp1.AddCollisionEvent(cc2.LocalID, contact);
}
//ctype = (int)CollisionCategories.Geom;
@@ -1359,8 +1359,8 @@ namespace OpenSim.Region.Physics.OdePlugin
if (p1 is OdeCharacter)
{
cc1 = (OdeCharacter) p1;
- obj2LocalID = cc1.m_localID;
- cc1.AddCollisionEvent(cp2.m_localID, contact);
+ obj2LocalID = cc1.LocalID;
+ cc1.AddCollisionEvent(cp2.LocalID, contact);
//ctype = (int)CollisionCategories.Character;
//if (cc1.CollidingObj)
@@ -1375,8 +1375,8 @@ namespace OpenSim.Region.Physics.OdePlugin
if (p1 is OdePrim)
{
cp1 = (OdePrim) p1;
- obj2LocalID = cp1.m_localID;
- cp1.AddCollisionEvent(cp2.m_localID, contact);
+ obj2LocalID = cp1.LocalID;
+ cp1.AddCollisionEvent(cp2.LocalID, contact);
//ctype = (int)CollisionCategories.Geom;
//if (cp1.CollidingObj)
@@ -1638,7 +1638,7 @@ namespace OpenSim.Region.Physics.OdePlugin
///
internal void AddCollisionEventReporting(PhysicsActor obj)
{
-// m_log.DebugFormat("[PHYSICS]: Adding {0} to collision event reporting", obj.SOPName);
+// m_log.DebugFormat("[PHYSICS]: Adding {0} {1} to collision event reporting", obj.SOPName, obj.LocalID);
lock (_collisionEventPrimChanges)
_collisionEventPrimChanges[obj.LocalID] = obj;
@@ -1650,7 +1650,7 @@ namespace OpenSim.Region.Physics.OdePlugin
///
internal void RemoveCollisionEventReporting(PhysicsActor obj)
{
-// m_log.DebugFormat("[PHYSICS]: Removing {0} from collision event reporting", obj.SOPName);
+// m_log.DebugFormat("[PHYSICS]: Removing {0} {1} from collision event reporting", obj.SOPName, obj.LocalID);
lock (_collisionEventPrimChanges)
_collisionEventPrimChanges[obj.LocalID] = null;
@@ -1754,9 +1754,7 @@ namespace OpenSim.Region.Physics.OdePlugin
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
{
-#if SPAM
- m_log.DebugFormat("[PHYSICS]: Adding physics actor to {0}", primName);
-#endif
+// m_log.DebugFormat("[ODE SCENE]: Adding physics actor to {0} {1}", primName, localid);
return AddPrim(primName, position, size, rotation, pbs, isPhysical, localid);
}
@@ -2810,7 +2808,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
foreach (PhysicsActor obj in _collisionEventPrim.Values)
{
-// m_log.DebugFormat("[PHYSICS]: Assessing {0} for collision events", obj.SOPName);
+// m_log.DebugFormat("[PHYSICS]: Assessing {0} {1} for collision events", obj.SOPName, obj.LocalID);
switch ((ActorTypes)obj.PhysicsActorType)
{
@@ -3746,7 +3744,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
{
if (prm.CollisionScore > 0)
{
- returncolliders.Add(prm.m_localID, prm.CollisionScore);
+ returncolliders.Add(prm.LocalID, prm.CollisionScore);
cnt++;
prm.CollisionScore = 0f;
if (cnt > 25)
diff --git a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs b/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs
index 2ea810f..cbc6b95 100644
--- a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs
+++ b/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs
@@ -104,7 +104,7 @@ namespace OpenSim.Region.Physics.OdePlugin.Tests
m_log.Info("TargetSpace: " + oprim.m_targetSpace + " - SceneMainSpace: " + pscene.space);
Assert.That(!oprim.m_taintadd);
- m_log.Info("Prim Position (" + oprim.m_localID + "): " + prim.Position.ToString());
+ m_log.Info("Prim Position (" + oprim.LocalID + "): " + prim.Position);
// Make sure we're above the ground
//Assert.That(prim.Position.Z > 20f);
--
cgit v1.1