aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-06-08 20:31:39 +0100
committerJustin Clark-Casey (justincc)2010-06-08 20:31:39 +0100
commit8b3b89ecf40ebe4e78ca77ccc5e14b2632829119 (patch)
treedac98391c08771590c1ac81baed405f26cc15f7f /OpenSim
parentremove references to OpenSim.Framework.Commuications.Tests.dll since all rele... (diff)
downloadopensim-SC-8b3b89ecf40ebe4e78ca77ccc5e14b2632829119.zip
opensim-SC-8b3b89ecf40ebe4e78ca77ccc5e14b2632829119.tar.gz
opensim-SC-8b3b89ecf40ebe4e78ca77ccc5e14b2632829119.tar.bz2
opensim-SC-8b3b89ecf40ebe4e78ca77ccc5e14b2632829119.tar.xz
backport xmlrpcgroups cache from master
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs23
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs6
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs135
5 files changed, 112 insertions, 59 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 58aa26a..20e53fc 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -3517,8 +3517,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3517// if (text.IndexOf("\n") >= 0) 3517// if (text.IndexOf("\n") >= 0)
3518// text = text.Remove(text.IndexOf("\n")); 3518// text = text.Remove(text.IndexOf("\n"));
3519// m_log.DebugFormat( 3519// m_log.DebugFormat(
3520// "[CLIENT]: Placing request to send full info about prim {0} text {1} to client {2}", 3520// "[CLIENT]: Queueing send full info about prim {0}, attachment {1}, text {2} to client {3}",
3521// data.localID, text, Name); 3521// data.localID, data.attachment, text, Name);
3522 3522
3523 if (data.priority == double.NaN) 3523 if (data.priority == double.NaN)
3524 { 3524 {
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index a972ca6..53556ab 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -411,18 +411,23 @@ namespace OpenSim.Region.CoreModules.World.Permissions
411 // with the powers requested (powers = 0 for no powers check) 411 // with the powers requested (powers = 0 for no powers check)
412 protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers) 412 protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers)
413 { 413 {
414 if (null == m_groupsModule) 414 //DateTime t1 = DateTime.Now;
415 return false; 415 bool result = false;
416 416
417 GroupMembershipData gmd = m_groupsModule.GetMembershipData(groupID, userID); 417 if (null != m_groupsModule)
418
419 if (gmd != null)
420 { 418 {
421 if (((gmd.GroupPowers != 0) && powers == 0) || (gmd.GroupPowers & powers) == powers) 419 GroupMembershipData gmd = m_groupsModule.GetMembershipData(groupID, userID);
422 return true; 420
421 if (gmd != null)
422 {
423 if (((gmd.GroupPowers != 0) && powers == 0) || (gmd.GroupPowers & powers) == powers)
424 result = true;
425 }
423 } 426 }
427
428 //m_log.DebugFormat("[PERMISSIONS]: Group member check took {0}", (DateTime.Now - t1).TotalMilliseconds);
424 429
425 return false; 430 return result;
426 } 431 }
427 432
428 /// <summary> 433 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index adc9496..869efd7 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -116,6 +116,8 @@ namespace OpenSim.Region.Framework.Scenes
116 /// <param name="remoteClient"></param> 116 /// <param name="remoteClient"></param>
117 public void RequestPrim(uint primLocalID, IClientAPI remoteClient) 117 public void RequestPrim(uint primLocalID, IClientAPI remoteClient)
118 { 118 {
119// m_log.DebugFormat("[SCENE]: {0} requested full update for {1}", remoteClient.Name, primLocalID);
120
119 List<EntityBase> EntityList = GetEntities(); 121 List<EntityBase> EntityList = GetEntities();
120 122
121 foreach (EntityBase ent in EntityList) 123 foreach (EntityBase ent in EntityList)
@@ -124,7 +126,6 @@ namespace OpenSim.Region.Framework.Scenes
124 { 126 {
125 if (((SceneObjectGroup)ent).LocalId == primLocalID) 127 if (((SceneObjectGroup)ent).LocalId == primLocalID)
126 { 128 {
127// m_log.DebugFormat("[SCENE]: Received full update request for {0} from {1}", primLocalID, remoteClient.Name);
128 ((SceneObjectGroup)ent).SendFullUpdateToClient(remoteClient); 129 ((SceneObjectGroup)ent).SendFullUpdateToClient(remoteClient);
129 return; 130 return;
130 } 131 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 451c6f9..fe5e948 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1519,7 +1519,7 @@ namespace OpenSim.Region.Framework.Scenes
1519 { 1519 {
1520// if (IsAttachment) 1520// if (IsAttachment)
1521// m_log.DebugFormat( 1521// m_log.DebugFormat(
1522// "[SOG]: Sending part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId); 1522// "[SOG]: Sending part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId);
1523 1523
1524 if (m_rootPart.UUID == part.UUID) 1524 if (m_rootPart.UUID == part.UUID)
1525 { 1525 {
@@ -2033,7 +2033,7 @@ namespace OpenSim.Region.Framework.Scenes
2033 public void ScheduleGroupForFullUpdate() 2033 public void ScheduleGroupForFullUpdate()
2034 { 2034 {
2035// if (IsAttachment) 2035// if (IsAttachment)
2036// m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, UUID); 2036// m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, LocalId);
2037 2037
2038 checkAtTargets(); 2038 checkAtTargets();
2039 RootPart.ScheduleFullUpdate(); 2039 RootPart.ScheduleFullUpdate();
@@ -2072,7 +2072,7 @@ namespace OpenSim.Region.Framework.Scenes
2072 if (IsDeleted) 2072 if (IsDeleted)
2073 return; 2073 return;
2074 2074
2075// m_log.DebugFormat("[SOG]: Sending immediate full group update for {0} {1}", Name, UUID); 2075// m_log.DebugFormat("[SOG]: Sending immediate full group update for {0} {1}", Name, LocalId);
2076 2076
2077 RootPart.SendFullUpdateToAllClients(); 2077 RootPart.SendFullUpdateToAllClients();
2078 2078
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
index 861731c..e64c9a7 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection; 31using System.Reflection;
32using System.Text;
32 33
33using Nwc.XmlRpc; 34using Nwc.XmlRpc;
34 35
@@ -42,6 +43,7 @@ using OpenMetaverse.StructuredData;
42using OpenSim.Framework; 43using OpenSim.Framework;
43using OpenSim.Framework.Communications; 44using OpenSim.Framework.Communications;
44using OpenSim.Region.Framework.Interfaces; 45using OpenSim.Region.Framework.Interfaces;
46using OpenSim.Services.Interfaces;
45 47
46namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups 48namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
47{ 49{
@@ -72,7 +74,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
72 74
73 private bool m_debugEnabled = false; 75 private bool m_debugEnabled = false;
74 76
75 77 private ExpiringCache<string, XmlRpcResponse> m_memoryCache;
78 private int m_cacheTimeout = 30;
79
76 // Used to track which agents are have dropped from a group chat session 80 // Used to track which agents are have dropped from a group chat session
77 // Should be reset per agent, on logon 81 // Should be reset per agent, on logon
78 // TODO: move this to Flotsam XmlRpc Service 82 // TODO: move this to Flotsam XmlRpc Service
@@ -132,8 +136,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
132 136
133 m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true); 137 m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true);
134 138
135 139 m_cacheTimeout = groupsConfig.GetInt("GroupsCacheTimeout", 30);
140 if (m_cacheTimeout == 0)
141 {
142 m_log.WarnFormat("[XMLRPC-GROUPS-CONNECTOR]: Groups Cache Disabled.");
143 }
144 else
145 {
146 m_log.InfoFormat("[XMLRPC-GROUPS-CONNECTOR]: Groups Cache Timeout set to {0}.", m_cacheTimeout);
147 }
148
136 // If we got all the config options we need, lets start'er'up 149 // If we got all the config options we need, lets start'er'up
150 m_memoryCache = new ExpiringCache<string, XmlRpcResponse>();
137 m_connectorEnabled = true; 151 m_connectorEnabled = true;
138 } 152 }
139 } 153 }
@@ -921,61 +935,94 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
921 /// </summary> 935 /// </summary>
922 private Hashtable XmlRpcCall(UUID requestingAgentID, string function, Hashtable param) 936 private Hashtable XmlRpcCall(UUID requestingAgentID, string function, Hashtable param)
923 { 937 {
924 string UserService; 938 XmlRpcResponse resp = null;
925 UUID SessionID; 939 string CacheKey = null;
926 GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID);
927 param.Add("RequestingAgentID", requestingAgentID.ToString());
928 param.Add("RequestingAgentUserService", UserService);
929 param.Add("RequestingSessionID", SessionID.ToString());
930
931
932 param.Add("ReadKey", m_groupReadKey);
933 param.Add("WriteKey", m_groupWriteKey);
934 940
935 if (m_debugEnabled) 941 // Only bother with the cache if it isn't disabled.
942 if (m_cacheTimeout > 0)
936 { 943 {
937 m_log.Debug("[XMLRPCGROUPDATA] XmlRpcCall Params:"); 944 if (!function.StartsWith("groups.get"))
938 foreach (string key in param.Keys)
939 { 945 {
940 m_log.DebugFormat("[XMLRPCGROUPDATA] {0} : {1}", key, param[key]); 946 // Any and all updates cause the cache to clear
947 m_memoryCache.Clear();
941 } 948 }
942 } 949 else
943 950 {
944 IList parameters = new ArrayList(); 951 StringBuilder sb = new StringBuilder(requestingAgentID + function);
945 parameters.Add(param); 952 foreach (object key in param.Keys)
946 953 {
947 ConfigurableKeepAliveXmlRpcRequest req; 954 if (param[key] != null)
948 req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive); 955 {
949 956 sb.AppendFormat(",{0}:{1}", key.ToString(), param[key].ToString());
950 XmlRpcResponse resp = null; 957 }
958 }
951 959
952 try 960 CacheKey = sb.ToString();
953 { 961 m_memoryCache.TryGetValue(CacheKey, out resp);
954 resp = req.Send(m_groupsServerURI, 10000); 962 }
955 } 963 }
956 catch (Exception e) 964
965 if (resp == null)
957 { 966 {
967 string UserService;
968 UUID SessionID;
969 GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID);
970 param.Add("RequestingAgentID", requestingAgentID.ToString());
971 param.Add("RequestingAgentUserService", UserService);
972 param.Add("RequestingSessionID", SessionID.ToString());
958 973
959 974
960 m_log.ErrorFormat("[XMLRPCGROUPDATA]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function); 975 param.Add("ReadKey", m_groupReadKey);
961 m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", e.ToString()); 976 param.Add("WriteKey", m_groupWriteKey);
962 977
963 if ((req != null) && (req.RequestResponse != null)) 978 if (m_debugEnabled)
964 {
965 foreach (string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine }, StringSplitOptions.None))
966 { 979 {
967 m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", ResponseLine); 980 m_log.Debug("[XMLRPCGROUPDATA] XmlRpcCall Params:");
981 foreach (string key in param.Keys)
982 {
983 m_log.DebugFormat("[XMLRPCGROUPDATA] {0} : {1}", key, param[key]);
984 }
968 } 985 }
986
987 IList parameters = new ArrayList();
988 parameters.Add(param);
989
990 ConfigurableKeepAliveXmlRpcRequest req;
991 req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive);
992
993 try
994 {
995 resp = req.Send(m_groupsServerURI, 10000);
996
997 if ((m_cacheTimeout > 0) && (CacheKey != null))
998 {
999 m_memoryCache.AddOrUpdate(CacheKey, resp, TimeSpan.FromSeconds(m_cacheTimeout));
1000 }
969 } 1001 }
970 1002 catch (Exception e)
971 foreach (string key in param.Keys)
972 { 1003 {
973 m_log.WarnFormat("[XMLRPCGROUPDATA]: {0} :: {1}", key, param[key].ToString()); 1004
1005
1006 m_log.ErrorFormat("[XMLRPCGROUPDATA]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function);
1007 m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", e.ToString());
1008
1009 if ((req != null) && (req.RequestResponse != null))
1010 {
1011 foreach (string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine }, StringSplitOptions.None))
1012 {
1013 m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", ResponseLine);
1014 }
1015 }
1016
1017 foreach (string key in param.Keys)
1018 {
1019 m_log.WarnFormat("[XMLRPCGROUPDATA]: {0} :: {1}", key, param[key].ToString());
1020 }
1021
1022 Hashtable respData = new Hashtable();
1023 respData.Add("error", e.ToString());
1024 return respData;
974 } 1025 }
975
976 Hashtable respData = new Hashtable();
977 respData.Add("error", e.ToString());
978 return respData;
979 } 1026 }
980 1027
981 1028