aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDiva Canto2011-06-06 19:52:50 -0700
committerDiva Canto2011-06-06 19:52:50 -0700
commit1a23d322ace6001130db24d11962850b333c8399 (patch)
tree65873b006577014175cbb747afa6ce01b4a52666 /OpenSim
parentMoved the Mono Addins declaration of the HGFriendsModule to where the one for... (diff)
downloadopensim-SC_OLD-1a23d322ace6001130db24d11962850b333c8399.zip
opensim-SC_OLD-1a23d322ace6001130db24d11962850b333c8399.tar.gz
opensim-SC_OLD-1a23d322ace6001130db24d11962850b333c8399.tar.bz2
opensim-SC_OLD-1a23d322ace6001130db24d11962850b333c8399.tar.xz
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.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs119
1 files changed, 71 insertions, 48 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
index f6f0e89..ddf9289 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
@@ -87,25 +87,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
87 if (base.FetchFriendslist(client)) 87 if (base.FetchFriendslist(client))
88 { 88 {
89 UUID agentID = client.AgentId; 89 UUID agentID = client.AgentId;
90 // We need to preload the user management cache with the names 90 // we do this only for the root agent
91 // of foreign friends, just like we do with SOPs' creators 91 if (m_Friends[agentID].Refcount == 1)
92 foreach (FriendInfo finfo in m_Friends[agentID].Friends)
93 { 92 {
94 if (finfo.TheirFlags != -1) 93 // We need to preload the user management cache with the names
94 // of foreign friends, just like we do with SOPs' creators
95 foreach (FriendInfo finfo in m_Friends[agentID].Friends)
95 { 96 {
96 UUID id; 97 if (finfo.TheirFlags != -1)
97 if (!UUID.TryParse(finfo.Friend, out id))
98 { 98 {
99 string url = string.Empty, first = string.Empty, last = string.Empty, tmp = string.Empty; 99 UUID id;
100 if (Util.ParseUniversalUserIdentifier(finfo.Friend, out id, out url, out first, out last, out tmp)) 100 if (!UUID.TryParse(finfo.Friend, out id))
101 { 101 {
102 IUserManagement uMan = m_Scenes[0].RequestModuleInterface<IUserManagement>(); 102 string url = string.Empty, first = string.Empty, last = string.Empty, tmp = string.Empty;
103 uMan.AddUser(id, url + ";" + first + " " + last); 103 if (Util.ParseUniversalUserIdentifier(finfo.Friend, out id, out url, out first, out last, out tmp))
104 {
105 IUserManagement uMan = m_Scenes[0].RequestModuleInterface<IUserManagement>();
106 uMan.AddUser(id, url + ";" + first + " " + last);
107 }
104 } 108 }
105 } 109 }
106 } 110 }
111 return true;
107 } 112 }
108 return true;
109 } 113 }
110 return false; 114 return false;
111 } 115 }
@@ -114,13 +118,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
114 { 118 {
115 if (base.SendFriendsOnlineIfNeeded(client)) 119 if (base.SendFriendsOnlineIfNeeded(client))
116 { 120 {
117 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, client.AgentId); 121 AgentCircuitData aCircuit = ((Scene)client.Scene).AuthenticateHandler.GetAgentCircuitData(client.AgentId);
118 if (account == null) // foreign 122 if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0)
119 { 123 {
120 FriendInfo[] friends = GetFriends(client.AgentId); 124 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, client.AgentId);
121 foreach (FriendInfo f in friends) 125 if (account == null) // foreign
122 { 126 {
123 client.SendChangeUserRights(new UUID(f.Friend), client.AgentId, f.TheirFlags); 127 FriendInfo[] friends = GetFriends(client.AgentId);
128 foreach (FriendInfo f in friends)
129 {
130 client.SendChangeUserRights(new UUID(f.Friend), client.AgentId, f.TheirFlags);
131 }
124 } 132 }
125 } 133 }
126 } 134 }
@@ -129,48 +137,63 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
129 137
130 protected override void GetOnlineFriends(UUID userID, List<string> friendList, /*collector*/ List<UUID> online) 138 protected override void GetOnlineFriends(UUID userID, List<string> friendList, /*collector*/ List<UUID> online)
131 { 139 {
132 // Let's single out the UUIs 140 List<string> fList = new List<string>();
133 List<string> localFriends = new List<string>();
134 List<string> foreignFriends = new List<string>();
135 string tmp = string.Empty;
136
137 foreach (string s in friendList) 141 foreach (string s in friendList)
138 { 142 fList.Add(s.Substring(0, 36));
139 UUID id;
140 if (UUID.TryParse(s, out id))
141 localFriends.Add(s);
142 else if (Util.ParseUniversalUserIdentifier(s, out id, out tmp, out tmp, out tmp, out tmp))
143 {
144 foreignFriends.Add(s);
145 // add it here too, who knows maybe the foreign friends happens to be on this grid
146 localFriends.Add(id.ToString());
147 }
148 }
149 143
150 // OK, see who's present on this grid 144 PresenceInfo[] presence = PresenceService.GetAgents(fList.ToArray());
151 List<string> toBeRemoved = new List<string>();
152 PresenceInfo[] presence = PresenceService.GetAgents(localFriends.ToArray());
153 foreach (PresenceInfo pi in presence) 145 foreach (PresenceInfo pi in presence)
154 { 146 {
155 UUID presenceID; 147 UUID presenceID;
156 if (UUID.TryParse(pi.UserID, out presenceID)) 148 if (UUID.TryParse(pi.UserID, out presenceID))
157 {
158 online.Add(presenceID); 149 online.Add(presenceID);
159 foreach (string s in foreignFriends)
160 if (s.StartsWith(pi.UserID))
161 toBeRemoved.Add(s);
162 }
163 } 150 }
164
165 foreach (string s in toBeRemoved)
166 foreignFriends.Remove(s);
167
168 // OK, let's send this up the stack, and leave a closure here
169 // collecting online friends in other grids
170 Util.FireAndForget(delegate { CollectOnlineFriendsElsewhere(userID, foreignFriends); });
171
172 } 151 }
173 152
153 //protected override void GetOnlineFriends(UUID userID, List<string> friendList, /*collector*/ List<UUID> online)
154 //{
155 // // Let's single out the UUIs
156 // List<string> localFriends = new List<string>();
157 // List<string> foreignFriends = new List<string>();
158 // string tmp = string.Empty;
159
160 // foreach (string s in friendList)
161 // {
162 // UUID id;
163 // if (UUID.TryParse(s, out id))
164 // localFriends.Add(s);
165 // else if (Util.ParseUniversalUserIdentifier(s, out id, out tmp, out tmp, out tmp, out tmp))
166 // {
167 // foreignFriends.Add(s);
168 // // add it here too, who knows maybe the foreign friends happens to be on this grid
169 // localFriends.Add(id.ToString());
170 // }
171 // }
172
173 // // OK, see who's present on this grid
174 // List<string> toBeRemoved = new List<string>();
175 // PresenceInfo[] presence = PresenceService.GetAgents(localFriends.ToArray());
176 // foreach (PresenceInfo pi in presence)
177 // {
178 // UUID presenceID;
179 // if (UUID.TryParse(pi.UserID, out presenceID))
180 // {
181 // online.Add(presenceID);
182 // foreach (string s in foreignFriends)
183 // if (s.StartsWith(pi.UserID))
184 // toBeRemoved.Add(s);
185 // }
186 // }
187
188 // foreach (string s in toBeRemoved)
189 // foreignFriends.Remove(s);
190
191 // // OK, let's send this up the stack, and leave a closure here
192 // // collecting online friends in other grids
193 // Util.FireAndForget(delegate { CollectOnlineFriendsElsewhere(userID, foreignFriends); });
194
195 //}
196
174 private void CollectOnlineFriendsElsewhere(UUID userID, List<string> foreignFriends) 197 private void CollectOnlineFriendsElsewhere(UUID userID, List<string> foreignFriends)
175 { 198 {
176 // let's divide the friends on a per-domain basis 199 // let's divide the friends on a per-domain basis