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.
bullet-2.82
Justin Clark-Casey (justincc) 2014-05-12 23:30:44 +01:00
parent 515d373a8e
commit 87e2668529
4 changed files with 35 additions and 20 deletions

View File

@ -210,7 +210,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
success = m_IMService.OutgoingInstantMessage(im, url, foreigner); success = m_IMService.OutgoingInstantMessage(im, url, foreigner);
if (!success && !foreigner) if (!success && !foreigner)
HandleUndeliveredMessage(im, result); HandleUndeliverableMessage(im, result);
else else
result(success); result(success);
}); });
@ -246,7 +246,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
return successful; return successful;
} }
protected void HandleUndeliveredMessage(GridInstantMessage im, MessageResultNotification result) public void HandleUndeliverableMessage(GridInstantMessage im, MessageResultNotification result)
{ {
UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage; UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage;

View File

@ -181,7 +181,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
SendGridInstantMessageViaXMLRPC(im, result); SendGridInstantMessageViaXMLRPC(im, result);
} }
private void HandleUndeliveredMessage(GridInstantMessage im, MessageResultNotification result) public void HandleUndeliverableMessage(GridInstantMessage im, MessageResultNotification result)
{ {
UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage; UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage;
@ -511,14 +511,14 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
if (upd.RegionID == prevRegionID) if (upd.RegionID == prevRegionID)
{ {
// m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); // m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message");
HandleUndeliveredMessage(im, result); HandleUndeliverableMessage(im, result);
return; return;
} }
} }
else else
{ {
// m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); // m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message");
HandleUndeliveredMessage(im, result); HandleUndeliverableMessage(im, result);
return; return;
} }
} }
@ -567,12 +567,12 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
else else
{ {
m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", upd.RegionID); m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", upd.RegionID);
HandleUndeliveredMessage(im, result); HandleUndeliverableMessage(im, result);
} }
} }
else else
{ {
HandleUndeliveredMessage(im, result); HandleUndeliverableMessage(im, result);
} }
} }

View File

@ -37,5 +37,7 @@ namespace OpenSim.Region.Framework.Interfaces
event UndeliveredMessage OnUndeliveredMessage; event UndeliveredMessage OnUndeliveredMessage;
void SendInstantMessage(GridInstantMessage im, MessageResultNotification result); void SendInstantMessage(GridInstantMessage im, MessageResultNotification result);
void HandleUndeliverableMessage(GridInstantMessage im, MessageResultNotification result);
} }
} }

View File

@ -248,6 +248,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
{ {
List<GroupMembersData> groupMembers = m_groupData.GetGroupMembers(sendingAgentForGroupCalls, groupID); List<GroupMembersData> groupMembers = m_groupData.GetGroupMembers(sendingAgentForGroupCalls, groupID);
int groupMembersCount = groupMembers.Count; int groupMembersCount = groupMembers.Count;
HashSet<string> attemptDeliveryUuidSet = null;
if (m_messageOnlineAgentsOnly) if (m_messageOnlineAgentsOnly)
{ {
@ -263,10 +264,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
m_usersOnlineCache.Add(groupID, onlineAgents, m_usersOnlineCacheExpirySeconds); m_usersOnlineCache.Add(groupID, onlineAgents, m_usersOnlineCacheExpirySeconds);
} }
HashSet<string> onlineAgentsUuidSet = new HashSet<string>(); attemptDeliveryUuidSet
Array.ForEach<PresenceInfo>(onlineAgents, pi => onlineAgentsUuidSet.Add(pi.UserID)); = new HashSet<string>(Array.ConvertAll<PresenceInfo, string>(onlineAgents, pi => pi.UserID));
groupMembers = groupMembers.Where(gmd => onlineAgentsUuidSet.Contains(gmd.AgentID.ToString())).ToList(); //Array.ForEach<PresenceInfo>(onlineAgents, pi => attemptDeliveryUuidSet.Add(pi.UserID));
//groupMembers = groupMembers.Where(gmd => onlineAgentsUuidSet.Contains(gmd.AgentID.ToString())).ToList();
// if (m_debugEnabled) // if (m_debugEnabled)
// m_log.DebugFormat( // m_log.DebugFormat(
@ -275,6 +278,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
} }
else else
{ {
attemptDeliveryUuidSet
= new HashSet<string>(groupMembers.ConvertAll<string>(gmd => gmd.AgentID.ToString()));
if (m_debugEnabled) if (m_debugEnabled)
m_log.DebugFormat( m_log.DebugFormat(
"[GROUPS-MESSAGING]: SendMessageToGroup called for group {0} with {1} visible members", "[GROUPS-MESSAGING]: SendMessageToGroup called for group {0} with {1} visible members",
@ -325,6 +331,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
msg.toAgentID = member.AgentID.Guid; msg.toAgentID = member.AgentID.Guid;
if (attemptDeliveryUuidSet.Contains(member.AgentID.ToString()))
{
IClientAPI client = GetActiveClient(member.AgentID); IClientAPI client = GetActiveClient(member.AgentID);
if (client == null) if (client == null)
{ {
@ -339,12 +347,17 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
ProcessMessageFromGroupSession(msg, client); ProcessMessageFromGroupSession(msg, client);
} }
} }
else
{
m_msgTransferModule.HandleUndeliverableMessage(msg, delegate(bool success) { });
}
}
// Temporary for assessing how long it still takes to send messages to large online groups. // Temporary for assessing how long it still takes to send messages to large online groups.
if (m_messageOnlineAgentsOnly) if (m_messageOnlineAgentsOnly)
m_log.DebugFormat( m_log.DebugFormat(
"[GROUPS-MESSAGING]: SendMessageToGroup for group {0} with {1} visible members, {2} online took {3}ms", "[GROUPS-MESSAGING]: SendMessageToGroup for group {0} with {1} members, {2} candidates for delivery took {3}ms",
groupID, groupMembersCount, groupMembers.Count(), Environment.TickCount - requestStartTick); groupID, groupMembersCount, attemptDeliveryUuidSet.Count(), Environment.TickCount - requestStartTick);
} }
#region SimGridEventHandlers #region SimGridEventHandlers