diff options
author | Diva Canto | 2011-06-10 21:17:34 -0700 |
---|---|---|
committer | Diva Canto | 2011-06-10 21:17:34 -0700 |
commit | e07d71d2982ac2c128035fee29991eda949bd8dd (patch) | |
tree | c18c5ff0a11dd2664b8d6f45b11541ca9a3d5524 /OpenSim/Region/CoreModules/Avatar/Friends | |
parent | More tweaking on the UserAgentServiceConnector: add constructor that does not... (diff) | |
download | opensim-SC_OLD-e07d71d2982ac2c128035fee29991eda949bd8dd.zip opensim-SC_OLD-e07d71d2982ac2c128035fee29991eda949bd8dd.tar.gz opensim-SC_OLD-e07d71d2982ac2c128035fee29991eda949bd8dd.tar.bz2 opensim-SC_OLD-e07d71d2982ac2c128035fee29991eda949bd8dd.tar.xz |
Added a Sleep in between each site call, to slow the xml-rpc requests down.
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Friends')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs | 77 |
1 files changed, 40 insertions, 37 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index b8342ef..40506a5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs | |||
@@ -29,6 +29,8 @@ using System; | |||
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Threading; | ||
33 | |||
32 | using log4net; | 34 | using log4net; |
33 | using Nini.Config; | 35 | using Nini.Config; |
34 | using Nwc.XmlRpc; | 36 | using Nwc.XmlRpc; |
@@ -194,46 +196,46 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
194 | 196 | ||
195 | //} | 197 | //} |
196 | 198 | ||
197 | private void CollectOnlineFriendsElsewhere(UUID userID, List<string> foreignFriends) | 199 | //private void CollectOnlineFriendsElsewhere(UUID userID, List<string> foreignFriends) |
198 | { | 200 | //{ |
199 | // let's divide the friends on a per-domain basis | 201 | // // let's divide the friends on a per-domain basis |
200 | Dictionary<string, List<string>> friendsPerDomain = new Dictionary<string, List<string>>(); | 202 | // Dictionary<string, List<string>> friendsPerDomain = new Dictionary<string, List<string>>(); |
201 | foreach (string friend in foreignFriends) | 203 | // foreach (string friend in foreignFriends) |
202 | { | 204 | // { |
203 | UUID friendID; | 205 | // UUID friendID; |
204 | if (!UUID.TryParse(friend, out friendID)) | 206 | // if (!UUID.TryParse(friend, out friendID)) |
205 | { | 207 | // { |
206 | // it's a foreign friend | 208 | // // it's a foreign friend |
207 | string url = string.Empty, tmp = string.Empty; | 209 | // string url = string.Empty, tmp = string.Empty; |
208 | if (Util.ParseUniversalUserIdentifier(friend, out friendID, out url, out tmp, out tmp, out tmp)) | 210 | // if (Util.ParseUniversalUserIdentifier(friend, out friendID, out url, out tmp, out tmp, out tmp)) |
209 | { | 211 | // { |
210 | if (!friendsPerDomain.ContainsKey(url)) | 212 | // if (!friendsPerDomain.ContainsKey(url)) |
211 | friendsPerDomain[url] = new List<string>(); | 213 | // friendsPerDomain[url] = new List<string>(); |
212 | friendsPerDomain[url].Add(friend); | 214 | // friendsPerDomain[url].Add(friend); |
213 | } | 215 | // } |
214 | } | 216 | // } |
215 | } | 217 | // } |
216 | 218 | ||
217 | // Now, call those worlds | 219 | // // Now, call those worlds |
218 | 220 | ||
219 | foreach (KeyValuePair<string, List<string>> kvp in friendsPerDomain) | 221 | // foreach (KeyValuePair<string, List<string>> kvp in friendsPerDomain) |
220 | { | 222 | // { |
221 | List<string> ids = new List<string>(); | 223 | // List<string> ids = new List<string>(); |
222 | foreach (string f in kvp.Value) | 224 | // foreach (string f in kvp.Value) |
223 | ids.Add(f); | 225 | // ids.Add(f); |
224 | UserAgentServiceConnector uConn = new UserAgentServiceConnector(kvp.Key); | 226 | // UserAgentServiceConnector uConn = new UserAgentServiceConnector(kvp.Key); |
225 | List<UUID> online = uConn.GetOnlineFriends(userID, ids); | 227 | // List<UUID> online = uConn.GetOnlineFriends(userID, ids); |
226 | // Finally send the notifications to the user | 228 | // // Finally send the notifications to the user |
227 | // this whole process may take a while, so let's check at every | 229 | // // this whole process may take a while, so let's check at every |
228 | // iteration that the user is still here | 230 | // // iteration that the user is still here |
229 | IClientAPI client = LocateClientObject(userID); | 231 | // IClientAPI client = LocateClientObject(userID); |
230 | if (client != null) | 232 | // if (client != null) |
231 | client.SendAgentOnline(online.ToArray()); | 233 | // client.SendAgentOnline(online.ToArray()); |
232 | else | 234 | // else |
233 | break; | 235 | // break; |
234 | } | 236 | // } |
235 | 237 | ||
236 | } | 238 | //} |
237 | 239 | ||
238 | protected override void StatusNotify(List<FriendInfo> friendList, UUID userID, bool online) | 240 | protected override void StatusNotify(List<FriendInfo> friendList, UUID userID, bool online) |
239 | { | 241 | { |
@@ -280,6 +282,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
280 | ids.Add(f.Friend); | 282 | ids.Add(f.Friend); |
281 | UserAgentServiceConnector uConn = new UserAgentServiceConnector(kvp.Key, false); | 283 | UserAgentServiceConnector uConn = new UserAgentServiceConnector(kvp.Key, false); |
282 | List<UUID> friendsOnline = uConn.StatusNotification(ids, userID, online); | 284 | List<UUID> friendsOnline = uConn.StatusNotification(ids, userID, online); |
285 | Thread.Sleep(100); | ||
283 | // need to debug this here | 286 | // need to debug this here |
284 | if (online) | 287 | if (online) |
285 | { | 288 | { |