aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs23
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs5
2 files changed, 13 insertions, 15 deletions
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
255 client.OnTerminateFriendship += (thisClient, agentID, exfriendID) => RemoveFriendship(thisClient, exfriendID); 255 client.OnTerminateFriendship += (thisClient, agentID, exfriendID) => RemoveFriendship(thisClient, exfriendID);
256 client.OnGrantUserRights += OnGrantUserRights; 256 client.OnGrantUserRights += OnGrantUserRights;
257 257
258 // Do not do this asynchronously. If we do, then subsequent code can outrace FetchFriendsList() and 258 // Do not do this asynchronously. If we do, then subsequent code can outrace CacheFriends() and
259 // return misleading results from the still empty friends cache. 259 // return misleading results from the still empty friends cache.
260 // If we absolutely need to do this asynchronously, then a signalling mechanism is needed so that calls 260 // If we absolutely need to do this asynchronously, then a signalling mechanism is needed so that calls
261 // to GetFriends() will wait until FetchFriendslist() completes. Locks are insufficient. 261 // to GetFriends() will wait until CacheFriends() completes. Locks are insufficient.
262 FetchFriendslist(client); 262 CacheFriends(client);
263 } 263 }
264 264
265 265
266 /// <summary> 266 /// <summary>
267 /// Fetch the friends list or increment the refcount for the existing 267 /// Cache the friends list or increment the refcount for the existing friends list.
268 /// friends list.
269 /// </summary> 268 /// </summary>
270 /// <param name="client"> 269 /// <param name="client">
271 /// </param> 270 /// </param>
272 /// <returns> 271 /// <returns>
273 /// Returns true if the list was fetched, false if it wasn't 272 /// Returns true if the list was fetched, false if it wasn't
274 /// </returns> 273 /// </returns>
275 protected virtual bool FetchFriendslist(IClientAPI client) 274 protected virtual bool CacheFriends(IClientAPI client)
276 { 275 {
277 UUID agentID = client.AgentId; 276 UUID agentID = client.AgentId;
278 lock (m_Friends) 277 lock (m_Friends)
@@ -319,7 +318,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
319 318
320 private void OnMakeRootAgent(ScenePresence sp) 319 private void OnMakeRootAgent(ScenePresence sp)
321 { 320 {
322 RefetchFriends(sp.ControllingClient); 321 RecacheFriends(sp.ControllingClient);
323 } 322 }
324 323
325 private void OnClientLogin(IClientAPI client) 324 private void OnClientLogin(IClientAPI client)
@@ -605,7 +604,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
605 StoreFriendships(client.AgentId, friendID); 604 StoreFriendships(client.AgentId, friendID);
606 605
607 // Update the local cache 606 // Update the local cache
608 RefetchFriends(client); 607 RecacheFriends(client);
609 608
610 // 609 //
611 // Notify the friend 610 // Notify the friend
@@ -667,7 +666,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
667 client.SendAlertMessage("Unable to terminate friendship on this sim."); 666 client.SendAlertMessage("Unable to terminate friendship on this sim.");
668 667
669 // Update local cache 668 // Update local cache
670 RefetchFriends(client); 669 RecacheFriends(client);
671 670
672 client.SendTerminateFriend(exfriendID); 671 client.SendTerminateFriend(exfriendID);
673 672
@@ -781,7 +780,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
781 friendClient.SendInstantMessage(im); 780 friendClient.SendInstantMessage(im);
782 781
783 // Update the local cache 782 // Update the local cache
784 RefetchFriends(friendClient); 783 RecacheFriends(friendClient);
785 784
786 // we're done 785 // we're done
787 return true; 786 return true;
@@ -814,7 +813,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
814 // the friend in this sim as root agent 813 // the friend in this sim as root agent
815 friendClient.SendTerminateFriend(exfriendID); 814 friendClient.SendTerminateFriend(exfriendID);
816 // update local cache 815 // update local cache
817 RefetchFriends(friendClient); 816 RecacheFriends(friendClient);
818 // we're done 817 // we're done
819 return true; 818 return true;
820 } 819 }
@@ -913,7 +912,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
913 return FriendsService.GetFriends(client.AgentId); 912 return FriendsService.GetFriends(client.AgentId);
914 } 913 }
915 914
916 private void RefetchFriends(IClientAPI client) 915 private void RecacheFriends(IClientAPI client)
917 { 916 {
918 UUID agentID = client.AgentId; 917 UUID agentID = client.AgentId;
919 lock (m_Friends) 918 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;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection; 31using System.Reflection;
32using System.Threading; 32using System.Threading;
33
34using log4net; 33using log4net;
35using Nini.Config; 34using Nini.Config;
36using Nwc.XmlRpc; 35using Nwc.XmlRpc;
@@ -84,9 +83,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
84 83
85 #endregion 84 #endregion
86 85
87 protected override bool FetchFriendslist(IClientAPI client) 86 protected override bool CacheFriends(IClientAPI client)
88 { 87 {
89 if (base.FetchFriendslist(client)) 88 if (base.CacheFriends(client))
90 { 89 {
91 UUID agentID = client.AgentId; 90 UUID agentID = client.AgentId;
92 // we do this only for the root agent 91 // we do this only for the root agent