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
parent
515d373a8e
commit
87e2668529
|
@ -210,7 +210,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
success = m_IMService.OutgoingInstantMessage(im, url, foreigner);
|
||||
|
||||
if (!success && !foreigner)
|
||||
HandleUndeliveredMessage(im, result);
|
||||
HandleUndeliverableMessage(im, result);
|
||||
else
|
||||
result(success);
|
||||
});
|
||||
|
@ -246,7 +246,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
return successful;
|
||||
}
|
||||
|
||||
protected void HandleUndeliveredMessage(GridInstantMessage im, MessageResultNotification result)
|
||||
public void HandleUndeliverableMessage(GridInstantMessage im, MessageResultNotification result)
|
||||
{
|
||||
UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage;
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
SendGridInstantMessageViaXMLRPC(im, result);
|
||||
}
|
||||
|
||||
private void HandleUndeliveredMessage(GridInstantMessage im, MessageResultNotification result)
|
||||
public void HandleUndeliverableMessage(GridInstantMessage im, MessageResultNotification result)
|
||||
{
|
||||
UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage;
|
||||
|
||||
|
@ -511,14 +511,14 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
if (upd.RegionID == prevRegionID)
|
||||
{
|
||||
// m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message");
|
||||
HandleUndeliveredMessage(im, result);
|
||||
HandleUndeliverableMessage(im, result);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message");
|
||||
HandleUndeliveredMessage(im, result);
|
||||
HandleUndeliverableMessage(im, result);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -567,12 +567,12 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
else
|
||||
{
|
||||
m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", upd.RegionID);
|
||||
HandleUndeliveredMessage(im, result);
|
||||
HandleUndeliverableMessage(im, result);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
HandleUndeliveredMessage(im, result);
|
||||
HandleUndeliverableMessage(im, result);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,5 +37,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
event UndeliveredMessage OnUndeliveredMessage;
|
||||
|
||||
void SendInstantMessage(GridInstantMessage im, MessageResultNotification result);
|
||||
|
||||
void HandleUndeliverableMessage(GridInstantMessage im, MessageResultNotification result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -248,6 +248,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
{
|
||||
List<GroupMembersData> groupMembers = m_groupData.GetGroupMembers(sendingAgentForGroupCalls, groupID);
|
||||
int groupMembersCount = groupMembers.Count;
|
||||
HashSet<string> attemptDeliveryUuidSet = null;
|
||||
|
||||
if (m_messageOnlineAgentsOnly)
|
||||
{
|
||||
|
@ -263,10 +264,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
m_usersOnlineCache.Add(groupID, onlineAgents, m_usersOnlineCacheExpirySeconds);
|
||||
}
|
||||
|
||||
HashSet<string> onlineAgentsUuidSet = new HashSet<string>();
|
||||
Array.ForEach<PresenceInfo>(onlineAgents, pi => onlineAgentsUuidSet.Add(pi.UserID));
|
||||
attemptDeliveryUuidSet
|
||||
= 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)
|
||||
// m_log.DebugFormat(
|
||||
|
@ -275,6 +278,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
}
|
||||
else
|
||||
{
|
||||
attemptDeliveryUuidSet
|
||||
= new HashSet<string>(groupMembers.ConvertAll<string>(gmd => gmd.AgentID.ToString()));
|
||||
|
||||
if (m_debugEnabled)
|
||||
m_log.DebugFormat(
|
||||
"[GROUPS-MESSAGING]: SendMessageToGroup called for group {0} with {1} visible members",
|
||||
|
@ -325,26 +331,33 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
|
||||
msg.toAgentID = member.AgentID.Guid;
|
||||
|
||||
IClientAPI client = GetActiveClient(member.AgentID);
|
||||
if (client == null)
|
||||
if (attemptDeliveryUuidSet.Contains(member.AgentID.ToString()))
|
||||
{
|
||||
// If they're not local, forward across the grid
|
||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Delivering to {0} via Grid", member.AgentID);
|
||||
m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { });
|
||||
IClientAPI client = GetActiveClient(member.AgentID);
|
||||
if (client == null)
|
||||
{
|
||||
// If they're not local, forward across the grid
|
||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Delivering to {0} via Grid", member.AgentID);
|
||||
m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { });
|
||||
}
|
||||
else
|
||||
{
|
||||
// Deliver locally, directly
|
||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Passing to ProcessMessageFromGroupSession to deliver to {0} locally", client.Name);
|
||||
ProcessMessageFromGroupSession(msg, client);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Deliver locally, directly
|
||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Passing to ProcessMessageFromGroupSession to deliver to {0} locally", client.Name);
|
||||
ProcessMessageFromGroupSession(msg, client);
|
||||
m_msgTransferModule.HandleUndeliverableMessage(msg, delegate(bool success) { });
|
||||
}
|
||||
}
|
||||
|
||||
// Temporary for assessing how long it still takes to send messages to large online groups.
|
||||
if (m_messageOnlineAgentsOnly)
|
||||
m_log.DebugFormat(
|
||||
"[GROUPS-MESSAGING]: SendMessageToGroup for group {0} with {1} visible members, {2} online took {3}ms",
|
||||
groupID, groupMembersCount, groupMembers.Count(), Environment.TickCount - requestStartTick);
|
||||
"[GROUPS-MESSAGING]: SendMessageToGroup for group {0} with {1} members, {2} candidates for delivery took {3}ms",
|
||||
groupID, groupMembersCount, attemptDeliveryUuidSet.Count(), Environment.TickCount - requestStartTick);
|
||||
}
|
||||
|
||||
#region SimGridEventHandlers
|
||||
|
|
Loading…
Reference in New Issue