diff options
author | Justin Clark-Casey (justincc) | 2014-05-12 23:30:44 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-05-12 23:38:48 +0100 |
commit | 87e2668529af4479e3dd94215193ff63ae685148 (patch) | |
tree | a5b8bc40112e3e4f749b372989acdde02e804ec5 /OpenSim/Region/OptionalModules | |
parent | Add send group notice regression test for when MessageOnlineUsersOnly=true (diff) | |
download | opensim-SC-87e2668529af4479e3dd94215193ff63ae685148.zip opensim-SC-87e2668529af4479e3dd94215193ff63ae685148.tar.gz opensim-SC-87e2668529af4479e3dd94215193ff63ae685148.tar.bz2 opensim-SC-87e2668529af4479e3dd94215193ff63ae685148.tar.xz |
For XmlRpcGroups (Flotsam) module, when MessageOnlineUsersOnly = true, handle notices to offline users directly as known undeliverable messages rather than discarding or attempting delivery.
Offline notices can still be controlled with the [Messaging] ForwardOfflineGroupMessages setting.
Looks to address more of http://opensimulator.org/mantis/view.php?id=7037
Only for Flotsam now for testing, but if approach works should be possible with core offline notices as well.
Diffstat (limited to 'OpenSim/Region/OptionalModules')
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs index f8fcd65..26b70a1 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs | |||
@@ -248,6 +248,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
248 | { | 248 | { |
249 | List<GroupMembersData> groupMembers = m_groupData.GetGroupMembers(sendingAgentForGroupCalls, groupID); | 249 | List<GroupMembersData> groupMembers = m_groupData.GetGroupMembers(sendingAgentForGroupCalls, groupID); |
250 | int groupMembersCount = groupMembers.Count; | 250 | int groupMembersCount = groupMembers.Count; |
251 | HashSet<string> attemptDeliveryUuidSet = null; | ||
251 | 252 | ||
252 | if (m_messageOnlineAgentsOnly) | 253 | if (m_messageOnlineAgentsOnly) |
253 | { | 254 | { |
@@ -263,10 +264,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
263 | m_usersOnlineCache.Add(groupID, onlineAgents, m_usersOnlineCacheExpirySeconds); | 264 | m_usersOnlineCache.Add(groupID, onlineAgents, m_usersOnlineCacheExpirySeconds); |
264 | } | 265 | } |
265 | 266 | ||
266 | HashSet<string> onlineAgentsUuidSet = new HashSet<string>(); | 267 | attemptDeliveryUuidSet |
267 | Array.ForEach<PresenceInfo>(onlineAgents, pi => onlineAgentsUuidSet.Add(pi.UserID)); | 268 | = new HashSet<string>(Array.ConvertAll<PresenceInfo, string>(onlineAgents, pi => pi.UserID)); |
268 | 269 | ||
269 | groupMembers = groupMembers.Where(gmd => onlineAgentsUuidSet.Contains(gmd.AgentID.ToString())).ToList(); | 270 | //Array.ForEach<PresenceInfo>(onlineAgents, pi => attemptDeliveryUuidSet.Add(pi.UserID)); |
271 | |||
272 | //groupMembers = groupMembers.Where(gmd => onlineAgentsUuidSet.Contains(gmd.AgentID.ToString())).ToList(); | ||
270 | 273 | ||
271 | // if (m_debugEnabled) | 274 | // if (m_debugEnabled) |
272 | // m_log.DebugFormat( | 275 | // m_log.DebugFormat( |
@@ -275,6 +278,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
275 | } | 278 | } |
276 | else | 279 | else |
277 | { | 280 | { |
281 | attemptDeliveryUuidSet | ||
282 | = new HashSet<string>(groupMembers.ConvertAll<string>(gmd => gmd.AgentID.ToString())); | ||
283 | |||
278 | if (m_debugEnabled) | 284 | if (m_debugEnabled) |
279 | m_log.DebugFormat( | 285 | m_log.DebugFormat( |
280 | "[GROUPS-MESSAGING]: SendMessageToGroup called for group {0} with {1} visible members", | 286 | "[GROUPS-MESSAGING]: SendMessageToGroup called for group {0} with {1} visible members", |
@@ -325,26 +331,33 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
325 | 331 | ||
326 | msg.toAgentID = member.AgentID.Guid; | 332 | msg.toAgentID = member.AgentID.Guid; |
327 | 333 | ||
328 | IClientAPI client = GetActiveClient(member.AgentID); | 334 | if (attemptDeliveryUuidSet.Contains(member.AgentID.ToString())) |
329 | if (client == null) | ||
330 | { | 335 | { |
331 | // If they're not local, forward across the grid | 336 | IClientAPI client = GetActiveClient(member.AgentID); |
332 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Delivering to {0} via Grid", member.AgentID); | 337 | if (client == null) |
333 | m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { }); | 338 | { |
339 | // If they're not local, forward across the grid | ||
340 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Delivering to {0} via Grid", member.AgentID); | ||
341 | m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { }); | ||
342 | } | ||
343 | else | ||
344 | { | ||
345 | // Deliver locally, directly | ||
346 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Passing to ProcessMessageFromGroupSession to deliver to {0} locally", client.Name); | ||
347 | ProcessMessageFromGroupSession(msg, client); | ||
348 | } | ||
334 | } | 349 | } |
335 | else | 350 | else |
336 | { | 351 | { |
337 | // Deliver locally, directly | 352 | m_msgTransferModule.HandleUndeliverableMessage(msg, delegate(bool success) { }); |
338 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Passing to ProcessMessageFromGroupSession to deliver to {0} locally", client.Name); | ||
339 | ProcessMessageFromGroupSession(msg, client); | ||
340 | } | 353 | } |
341 | } | 354 | } |
342 | 355 | ||
343 | // Temporary for assessing how long it still takes to send messages to large online groups. | 356 | // Temporary for assessing how long it still takes to send messages to large online groups. |
344 | if (m_messageOnlineAgentsOnly) | 357 | if (m_messageOnlineAgentsOnly) |
345 | m_log.DebugFormat( | 358 | m_log.DebugFormat( |
346 | "[GROUPS-MESSAGING]: SendMessageToGroup for group {0} with {1} visible members, {2} online took {3}ms", | 359 | "[GROUPS-MESSAGING]: SendMessageToGroup for group {0} with {1} members, {2} candidates for delivery took {3}ms", |
347 | groupID, groupMembersCount, groupMembers.Count(), Environment.TickCount - requestStartTick); | 360 | groupID, groupMembersCount, attemptDeliveryUuidSet.Count(), Environment.TickCount - requestStartTick); |
348 | } | 361 | } |
349 | 362 | ||
350 | #region SimGridEventHandlers | 363 | #region SimGridEventHandlers |