Rename FetchFriendslist() -> CacheFriends() and RefetchFriends() -> RecacheFriends() to reflect their intended function

0.7.2-post-fixes
Justin Clark-Casey (justincc) 2011-11-15 16:12:35 +00:00
parent 1fa0c2f9b0
commit a88381ba82
2 changed files with 13 additions and 15 deletions

View File

@ -255,24 +255,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
client.OnTerminateFriendship += (thisClient, agentID, exfriendID) => RemoveFriendship(thisClient, exfriendID); client.OnTerminateFriendship += (thisClient, agentID, exfriendID) => RemoveFriendship(thisClient, exfriendID);
client.OnGrantUserRights += OnGrantUserRights; 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. // 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 // 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. // to GetFriends() will wait until CacheFriends() completes. Locks are insufficient.
FetchFriendslist(client); CacheFriends(client);
} }
/// <summary> /// <summary>
/// Fetch the friends list or increment the refcount for the existing /// Cache the friends list or increment the refcount for the existing friends list.
/// friends list.
/// </summary> /// </summary>
/// <param name="client"> /// <param name="client">
/// </param> /// </param>
/// <returns> /// <returns>
/// Returns true if the list was fetched, false if it wasn't /// Returns true if the list was fetched, false if it wasn't
/// </returns> /// </returns>
protected virtual bool FetchFriendslist(IClientAPI client) protected virtual bool CacheFriends(IClientAPI client)
{ {
UUID agentID = client.AgentId; UUID agentID = client.AgentId;
lock (m_Friends) lock (m_Friends)
@ -319,7 +318,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
private void OnMakeRootAgent(ScenePresence sp) private void OnMakeRootAgent(ScenePresence sp)
{ {
RefetchFriends(sp.ControllingClient); RecacheFriends(sp.ControllingClient);
} }
private void OnClientLogin(IClientAPI client) private void OnClientLogin(IClientAPI client)
@ -613,7 +612,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
StoreFriendships(client.AgentId, friendID); StoreFriendships(client.AgentId, friendID);
// Update the local cache // Update the local cache
RefetchFriends(client); RecacheFriends(client);
// //
// Notify the friend // Notify the friend
@ -675,7 +674,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
client.SendAlertMessage("Unable to terminate friendship on this sim."); client.SendAlertMessage("Unable to terminate friendship on this sim.");
// Update local cache // Update local cache
RefetchFriends(client); RecacheFriends(client);
client.SendTerminateFriend(exfriendID); client.SendTerminateFriend(exfriendID);
@ -789,7 +788,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
friendClient.SendInstantMessage(im); friendClient.SendInstantMessage(im);
// Update the local cache // Update the local cache
RefetchFriends(friendClient); RecacheFriends(friendClient);
// we're done // we're done
return true; return true;
@ -822,7 +821,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// the friend in this sim as root agent // the friend in this sim as root agent
friendClient.SendTerminateFriend(exfriendID); friendClient.SendTerminateFriend(exfriendID);
// update local cache // update local cache
RefetchFriends(friendClient); RecacheFriends(friendClient);
// we're done // we're done
return true; return true;
} }
@ -921,7 +920,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
return FriendsService.GetFriends(client.AgentId); return FriendsService.GetFriends(client.AgentId);
} }
private void RefetchFriends(IClientAPI client) private void RecacheFriends(IClientAPI client)
{ {
UUID agentID = client.AgentId; UUID agentID = client.AgentId;
lock (m_Friends) lock (m_Friends)

View File

@ -30,7 +30,6 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using System.Threading; using System.Threading;
using log4net; using log4net;
using Nini.Config; using Nini.Config;
using Nwc.XmlRpc; using Nwc.XmlRpc;
@ -84,9 +83,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
#endregion #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; UUID agentID = client.AgentId;
// we do this only for the root agent // we do this only for the root agent