More on the hunt for the slow down on HGFriendsModule. - Don't requests the online friends on foreign grids. If this works, there's another way of getting that info.
parent
dce0e46eaa
commit
1a23d322ac
|
@ -87,25 +87,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
if (base.FetchFriendslist(client))
|
if (base.FetchFriendslist(client))
|
||||||
{
|
{
|
||||||
UUID agentID = client.AgentId;
|
UUID agentID = client.AgentId;
|
||||||
// We need to preload the user management cache with the names
|
// we do this only for the root agent
|
||||||
// of foreign friends, just like we do with SOPs' creators
|
if (m_Friends[agentID].Refcount == 1)
|
||||||
foreach (FriendInfo finfo in m_Friends[agentID].Friends)
|
|
||||||
{
|
{
|
||||||
if (finfo.TheirFlags != -1)
|
// We need to preload the user management cache with the names
|
||||||
|
// of foreign friends, just like we do with SOPs' creators
|
||||||
|
foreach (FriendInfo finfo in m_Friends[agentID].Friends)
|
||||||
{
|
{
|
||||||
UUID id;
|
if (finfo.TheirFlags != -1)
|
||||||
if (!UUID.TryParse(finfo.Friend, out id))
|
|
||||||
{
|
{
|
||||||
string url = string.Empty, first = string.Empty, last = string.Empty, tmp = string.Empty;
|
UUID id;
|
||||||
if (Util.ParseUniversalUserIdentifier(finfo.Friend, out id, out url, out first, out last, out tmp))
|
if (!UUID.TryParse(finfo.Friend, out id))
|
||||||
{
|
{
|
||||||
IUserManagement uMan = m_Scenes[0].RequestModuleInterface<IUserManagement>();
|
string url = string.Empty, first = string.Empty, last = string.Empty, tmp = string.Empty;
|
||||||
uMan.AddUser(id, url + ";" + first + " " + last);
|
if (Util.ParseUniversalUserIdentifier(finfo.Friend, out id, out url, out first, out last, out tmp))
|
||||||
|
{
|
||||||
|
IUserManagement uMan = m_Scenes[0].RequestModuleInterface<IUserManagement>();
|
||||||
|
uMan.AddUser(id, url + ";" + first + " " + last);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -114,13 +118,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
{
|
{
|
||||||
if (base.SendFriendsOnlineIfNeeded(client))
|
if (base.SendFriendsOnlineIfNeeded(client))
|
||||||
{
|
{
|
||||||
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, client.AgentId);
|
AgentCircuitData aCircuit = ((Scene)client.Scene).AuthenticateHandler.GetAgentCircuitData(client.AgentId);
|
||||||
if (account == null) // foreign
|
if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0)
|
||||||
{
|
{
|
||||||
FriendInfo[] friends = GetFriends(client.AgentId);
|
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, client.AgentId);
|
||||||
foreach (FriendInfo f in friends)
|
if (account == null) // foreign
|
||||||
{
|
{
|
||||||
client.SendChangeUserRights(new UUID(f.Friend), client.AgentId, f.TheirFlags);
|
FriendInfo[] friends = GetFriends(client.AgentId);
|
||||||
|
foreach (FriendInfo f in friends)
|
||||||
|
{
|
||||||
|
client.SendChangeUserRights(new UUID(f.Friend), client.AgentId, f.TheirFlags);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,48 +137,63 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
|
|
||||||
protected override void GetOnlineFriends(UUID userID, List<string> friendList, /*collector*/ List<UUID> online)
|
protected override void GetOnlineFriends(UUID userID, List<string> friendList, /*collector*/ List<UUID> online)
|
||||||
{
|
{
|
||||||
// Let's single out the UUIs
|
List<string> fList = new List<string>();
|
||||||
List<string> localFriends = new List<string>();
|
|
||||||
List<string> foreignFriends = new List<string>();
|
|
||||||
string tmp = string.Empty;
|
|
||||||
|
|
||||||
foreach (string s in friendList)
|
foreach (string s in friendList)
|
||||||
{
|
fList.Add(s.Substring(0, 36));
|
||||||
UUID id;
|
|
||||||
if (UUID.TryParse(s, out id))
|
|
||||||
localFriends.Add(s);
|
|
||||||
else if (Util.ParseUniversalUserIdentifier(s, out id, out tmp, out tmp, out tmp, out tmp))
|
|
||||||
{
|
|
||||||
foreignFriends.Add(s);
|
|
||||||
// add it here too, who knows maybe the foreign friends happens to be on this grid
|
|
||||||
localFriends.Add(id.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// OK, see who's present on this grid
|
PresenceInfo[] presence = PresenceService.GetAgents(fList.ToArray());
|
||||||
List<string> toBeRemoved = new List<string>();
|
|
||||||
PresenceInfo[] presence = PresenceService.GetAgents(localFriends.ToArray());
|
|
||||||
foreach (PresenceInfo pi in presence)
|
foreach (PresenceInfo pi in presence)
|
||||||
{
|
{
|
||||||
UUID presenceID;
|
UUID presenceID;
|
||||||
if (UUID.TryParse(pi.UserID, out presenceID))
|
if (UUID.TryParse(pi.UserID, out presenceID))
|
||||||
{
|
|
||||||
online.Add(presenceID);
|
online.Add(presenceID);
|
||||||
foreach (string s in foreignFriends)
|
|
||||||
if (s.StartsWith(pi.UserID))
|
|
||||||
toBeRemoved.Add(s);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (string s in toBeRemoved)
|
|
||||||
foreignFriends.Remove(s);
|
|
||||||
|
|
||||||
// OK, let's send this up the stack, and leave a closure here
|
|
||||||
// collecting online friends in other grids
|
|
||||||
Util.FireAndForget(delegate { CollectOnlineFriendsElsewhere(userID, foreignFriends); });
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//protected override void GetOnlineFriends(UUID userID, List<string> friendList, /*collector*/ List<UUID> online)
|
||||||
|
//{
|
||||||
|
// // Let's single out the UUIs
|
||||||
|
// List<string> localFriends = new List<string>();
|
||||||
|
// List<string> foreignFriends = new List<string>();
|
||||||
|
// string tmp = string.Empty;
|
||||||
|
|
||||||
|
// foreach (string s in friendList)
|
||||||
|
// {
|
||||||
|
// UUID id;
|
||||||
|
// if (UUID.TryParse(s, out id))
|
||||||
|
// localFriends.Add(s);
|
||||||
|
// else if (Util.ParseUniversalUserIdentifier(s, out id, out tmp, out tmp, out tmp, out tmp))
|
||||||
|
// {
|
||||||
|
// foreignFriends.Add(s);
|
||||||
|
// // add it here too, who knows maybe the foreign friends happens to be on this grid
|
||||||
|
// localFriends.Add(id.ToString());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // OK, see who's present on this grid
|
||||||
|
// List<string> toBeRemoved = new List<string>();
|
||||||
|
// PresenceInfo[] presence = PresenceService.GetAgents(localFriends.ToArray());
|
||||||
|
// foreach (PresenceInfo pi in presence)
|
||||||
|
// {
|
||||||
|
// UUID presenceID;
|
||||||
|
// if (UUID.TryParse(pi.UserID, out presenceID))
|
||||||
|
// {
|
||||||
|
// online.Add(presenceID);
|
||||||
|
// foreach (string s in foreignFriends)
|
||||||
|
// if (s.StartsWith(pi.UserID))
|
||||||
|
// toBeRemoved.Add(s);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// foreach (string s in toBeRemoved)
|
||||||
|
// foreignFriends.Remove(s);
|
||||||
|
|
||||||
|
// // OK, let's send this up the stack, and leave a closure here
|
||||||
|
// // collecting online friends in other grids
|
||||||
|
// Util.FireAndForget(delegate { CollectOnlineFriendsElsewhere(userID, foreignFriends); });
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
private void CollectOnlineFriendsElsewhere(UUID userID, List<string> foreignFriends)
|
private void CollectOnlineFriendsElsewhere(UUID userID, List<string> foreignFriends)
|
||||||
{
|
{
|
||||||
// let's divide the friends on a per-domain basis
|
// let's divide the friends on a per-domain basis
|
||||||
|
|
Loading…
Reference in New Issue