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 | |
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')
4 files changed, 35 insertions, 20 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs index c51b30f..6f3c80a 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs | |||
@@ -210,7 +210,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
210 | success = m_IMService.OutgoingInstantMessage(im, url, foreigner); | 210 | success = m_IMService.OutgoingInstantMessage(im, url, foreigner); |
211 | 211 | ||
212 | if (!success && !foreigner) | 212 | if (!success && !foreigner) |
213 | HandleUndeliveredMessage(im, result); | 213 | HandleUndeliverableMessage(im, result); |
214 | else | 214 | else |
215 | result(success); | 215 | result(success); |
216 | }); | 216 | }); |
@@ -246,7 +246,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
246 | return successful; | 246 | return successful; |
247 | } | 247 | } |
248 | 248 | ||
249 | protected void HandleUndeliveredMessage(GridInstantMessage im, MessageResultNotification result) | 249 | public void HandleUndeliverableMessage(GridInstantMessage im, MessageResultNotification result) |
250 | { | 250 | { |
251 | UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage; | 251 | UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage; |
252 | 252 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 40a400f..7aa7123 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | |||
@@ -181,7 +181,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
181 | SendGridInstantMessageViaXMLRPC(im, result); | 181 | SendGridInstantMessageViaXMLRPC(im, result); |
182 | } | 182 | } |
183 | 183 | ||
184 | private void HandleUndeliveredMessage(GridInstantMessage im, MessageResultNotification result) | 184 | public void HandleUndeliverableMessage(GridInstantMessage im, MessageResultNotification result) |
185 | { | 185 | { |
186 | UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage; | 186 | UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage; |
187 | 187 | ||
@@ -511,14 +511,14 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
511 | if (upd.RegionID == prevRegionID) | 511 | if (upd.RegionID == prevRegionID) |
512 | { | 512 | { |
513 | // m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); | 513 | // m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); |
514 | HandleUndeliveredMessage(im, result); | 514 | HandleUndeliverableMessage(im, result); |
515 | return; | 515 | return; |
516 | } | 516 | } |
517 | } | 517 | } |
518 | else | 518 | else |
519 | { | 519 | { |
520 | // m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); | 520 | // m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); |
521 | HandleUndeliveredMessage(im, result); | 521 | HandleUndeliverableMessage(im, result); |
522 | return; | 522 | return; |
523 | } | 523 | } |
524 | } | 524 | } |
@@ -567,12 +567,12 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
567 | else | 567 | else |
568 | { | 568 | { |
569 | m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", upd.RegionID); | 569 | m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", upd.RegionID); |
570 | HandleUndeliveredMessage(im, result); | 570 | HandleUndeliverableMessage(im, result); |
571 | } | 571 | } |
572 | } | 572 | } |
573 | else | 573 | else |
574 | { | 574 | { |
575 | HandleUndeliveredMessage(im, result); | 575 | HandleUndeliverableMessage(im, result); |
576 | } | 576 | } |
577 | } | 577 | } |
578 | 578 | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IMessageTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IMessageTransferModule.cs index b0b47a7..379c769 100644 --- a/OpenSim/Region/Framework/Interfaces/IMessageTransferModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IMessageTransferModule.cs | |||
@@ -37,5 +37,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
37 | event UndeliveredMessage OnUndeliveredMessage; | 37 | event UndeliveredMessage OnUndeliveredMessage; |
38 | 38 | ||
39 | void SendInstantMessage(GridInstantMessage im, MessageResultNotification result); | 39 | void SendInstantMessage(GridInstantMessage im, MessageResultNotification result); |
40 | |||
41 | void HandleUndeliverableMessage(GridInstantMessage im, MessageResultNotification result); | ||
40 | } | 42 | } |
41 | } | 43 | } |
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 |