From 8d99fe095a231ba71ce71712cb87f8114672e7df Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 19 Jun 2016 17:35:11 -0700 Subject: Mantis #7920: group info was not being updated in many situations. (regression) Putting back the heavy messaging. --- OpenSim/Addons/Groups/GroupsModule.cs | 47 +++++++++++++++++----- .../Linden/Caps/EventQueue/EventQueueGetModule.cs | 4 +- .../Linden/Caps/EventQueue/EventQueueHelper.cs | 20 ++++----- OpenSim/Region/Framework/Interfaces/IEventQueue.cs | 2 +- .../Avatar/XmlRpcGroups/GroupsModule.cs | 46 +++++++++++++++------ .../Tests/Common/Mock/TestEventQueueGetModule.cs | 2 +- 6 files changed, 85 insertions(+), 36 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Addons/Groups/GroupsModule.cs b/OpenSim/Addons/Groups/GroupsModule.cs index f24670a..d27797e 100644 --- a/OpenSim/Addons/Groups/GroupsModule.cs +++ b/OpenSim/Addons/Groups/GroupsModule.cs @@ -394,9 +394,8 @@ namespace OpenSim.Groups OutgoingInstantMessage(msg, invitee); - IClientAPI client = GetActiveClient(invitee); - if (client != null) - SendDataUpdate(remoteClient, true); + UpdateAllClientsWithGroupInfo(invitee); + } m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentIDStr(remoteClient), inviteID); @@ -1112,7 +1111,7 @@ namespace OpenSim.Groups // SL sends out messages to everyone in the group // Who all should receive updates and what should they be updated with? - SendAgentGroupDataUpdate(remoteClient, false); + UpdateAllClientsWithGroupInfo(ejecteeID); } public void InviteGroupRequest(IClientAPI remoteClient, UUID groupID, UUID invitedAgentID, UUID roleID) @@ -1226,16 +1225,44 @@ namespace OpenSim.Groups } } + /// + /// Send updates to all clients who might be interested in groups data for dataForClientID + /// + private void UpdateAllClientsWithGroupInfo(UUID dataForClientID) + { + if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); + + // TODO: Probably isn't nessesary to update every client in every scene. + // Need to examine client updates and do only what's nessesary. + lock (m_sceneList) + { + foreach (Scene scene in m_sceneList) + { + scene.ForEachClient(delegate (IClientAPI client) { SendAgentGroupDataUpdate(client, dataForClientID); }); + } + } + } + public void SendAgentGroupDataUpdate(IClientAPI remoteClient) { - SendAgentGroupDataUpdate(remoteClient, true); + SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient), true); + } + + public void SendAgentGroupDataUpdate(IClientAPI remoteClient, UUID dataForClientID) + { + SendAgentGroupDataUpdate(remoteClient, dataForClientID, true); } - - /// - /// Tell remoteClient about its agent groups, and optionally send title to others - /// + private void SendAgentGroupDataUpdate(IClientAPI remoteClient, bool tellOthers) { + SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient), tellOthers); + } + + /// + /// Tell remoteClient about its agent groups, and optionally send title to others + /// + private void SendAgentGroupDataUpdate(IClientAPI remoteClient, UUID dataForClientID, bool tellOthers) + { if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called for {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name); // TODO: All the client update functions need to be reexamined because most do too much and send too much stuff @@ -1246,7 +1273,7 @@ namespace OpenSim.Groups GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, agentID); IEventQueue eq = remoteClient.Scene.RequestModuleInterface(); - eq.GroupMembershipData(GetRequestingAgentID(remoteClient), membershipArray); + eq.GroupMembershipData(GetRequestingAgentID(remoteClient), dataForClientID, membershipArray); remoteClient.RefreshGroupMembership(); } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index 9a1cef4..d628cfc 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -585,9 +585,9 @@ namespace OpenSim.Region.ClientStack.Linden Enqueue(item, avatarID); } - public void GroupMembershipData(UUID receiverAgent, GroupMembershipData[] data) + public void GroupMembershipData(UUID receiverAgent, UUID dataForClientID, GroupMembershipData[] data) { - OSD item = EventQueueHelper.GroupMembershipData(receiverAgent, data); + OSD item = EventQueueHelper.GroupMembershipData(receiverAgent, dataForClientID, data); Enqueue(item, receiverAgent); } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs index 2344fc6..7c8f441 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs @@ -367,7 +367,7 @@ namespace OpenSim.Region.ClientStack.Linden return groupUpdate; } - public static OSD GroupMembershipData(UUID receiverAgent, GroupMembershipData[] data) + public static OSD GroupMembershipData(UUID receiverAgent, UUID dataForAgentID, GroupMembershipData[] data) { OSDArray AgentData = new OSDArray(1); OSDMap AgentDataMap = new OSDMap(1); @@ -379,15 +379,15 @@ namespace OpenSim.Region.ClientStack.Linden foreach (GroupMembershipData membership in data) { - //if (receiverAgent != dataForAgentID) - //{ - // if (!membership.ListInProfile) - // { - // // If we're sending group info to remoteclient about another agent, - // // filter out groups the other agent doesn't want to share. - // continue; - // } - //} + if (receiverAgent != dataForAgentID) + { + if (!membership.ListInProfile) + { + // If we're sending group info to remoteclient about another agent, + // filter out groups the other agent doesn't want to share. + continue; + } + } OSDMap GroupDataMap = new OSDMap(6); OSDMap NewGroupDataMap = new OSDMap(1); diff --git a/OpenSim/Region/Framework/Interfaces/IEventQueue.cs b/OpenSim/Region/Framework/Interfaces/IEventQueue.cs index f4014db..1f29f7b 100644 --- a/OpenSim/Region/Framework/Interfaces/IEventQueue.cs +++ b/OpenSim/Region/Framework/Interfaces/IEventQueue.cs @@ -59,7 +59,7 @@ namespace OpenSim.Region.Framework.Interfaces bool isModerator, bool textMute); void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID); void GroupMembership(AgentGroupDataUpdatePacket groupUpdate, UUID avatarID); - void GroupMembershipData(UUID receiverAgent, GroupMembershipData[] data); + void GroupMembershipData(UUID receiverAgent, UUID dataForClientID, GroupMembershipData[] data); OSD ScriptRunningEvent(UUID objectID, UUID itemID, bool running, bool mono); OSD BuildEvent(string eventName, OSD eventBody); void partPhysicsProperties(uint localID, byte physhapetype, float density, float friction, float bounce, float gravmod, UUID avatarID); diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 5dfbe2c..ef14270 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -442,12 +442,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups OutgoingInstantMessage(msg, inviteInfo.AgentID); - IClientAPI client = GetActiveClient(inviteInfo.AgentID); - if (client != null) - SendDataUpdate(remoteClient, true); - - // TODO: If the inviter is still online, they need an agent dataupdate - // and maybe group membership updates for the invitee + UpdateAllClientsWithGroupInfo(inviteInfo.AgentID); m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentID(remoteClient), inviteID); } @@ -1207,8 +1202,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // SL sends out messages to everyone in the group // Who all should receive updates and what should they be updated with? // just tell this the group change - SendAgentGroupDataUpdate(remoteClient, false); - // TODO fix the rest of sends + UpdateAllClientsWithGroupInfo(ejecteeID); } public void InviteGroupRequest(IClientAPI remoteClient, UUID groupID, UUID invitedAgentID, UUID roleID) @@ -1353,16 +1347,44 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } } + /// + /// Send updates to all clients who might be interested in groups data for dataForClientID + /// + private void UpdateAllClientsWithGroupInfo(UUID dataForClientID) + { + if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); + + // TODO: Probably isn't nessesary to update every client in every scene. + // Need to examine client updates and do only what's nessesary. + lock (m_sceneList) + { + foreach (Scene scene in m_sceneList) + { + scene.ForEachClient(delegate (IClientAPI client) { SendAgentGroupDataUpdate(client, dataForClientID); }); + } + } + } + public void SendAgentGroupDataUpdate(IClientAPI remoteClient) { SendAgentGroupDataUpdate(remoteClient, true); } - /// - /// Tell remoteClient about its agent groups, and optionally send title to others - /// + public void SendAgentGroupDataUpdate(IClientAPI remoteClient, UUID dataForClientID) + { + SendAgentGroupDataUpdate(remoteClient, dataForClientID, true); + } + private void SendAgentGroupDataUpdate(IClientAPI remoteClient, bool tellOthers) { + SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient), tellOthers); + } + + /// + /// Tell remoteClient about its agent groups, and optionally send title to others + /// + private void SendAgentGroupDataUpdate(IClientAPI remoteClient, UUID dataForClientID, bool tellOthers) + { if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: {0} called for {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name); // TODO: All the client update functions need to be reexamined because most do too much and send too much stuff @@ -1373,7 +1395,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, agentID); IEventQueue eq = remoteClient.Scene.RequestModuleInterface(); - eq.GroupMembershipData(GetRequestingAgentID(remoteClient), membershipArray); + eq.GroupMembershipData(GetRequestingAgentID(remoteClient), dataForClientID, membershipArray); remoteClient.RefreshGroupMembership(); } diff --git a/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs b/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs index 332d59c..192f84f 100644 --- a/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs +++ b/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs @@ -162,7 +162,7 @@ namespace OpenSim.Tests.Common AddEvent(avatarID, "GroupMembership", groupUpdate); } - public void GroupMembershipData(UUID receiverAgent, GroupMembershipData[] data) + public void GroupMembershipData(UUID receiverAgent, UUID dataForClientID, GroupMembershipData[] data) { AddEvent(receiverAgent, "AgentGroupDataUpdate", data); } -- cgit v1.1