diff options
author | Melanie | 2011-02-07 22:08:53 +0000 |
---|---|---|
committer | Melanie | 2011-02-07 22:08:53 +0000 |
commit | 3889e68c5441218a2ffeb2094b8251d31369837b (patch) | |
tree | 69608c869c3823df4f417d9df34866f400045533 | |
parent | Repair x-query-string (diff) | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-SC_OLD-3889e68c5441218a2ffeb2094b8251d31369837b.zip opensim-SC_OLD-3889e68c5441218a2ffeb2094b8251d31369837b.tar.gz opensim-SC_OLD-3889e68c5441218a2ffeb2094b8251d31369837b.tar.bz2 opensim-SC_OLD-3889e68c5441218a2ffeb2094b8251d31369837b.tar.xz |
Merge branch 'master' into careminster-presence-refactor
Conflicts:
OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs
OpenSim/Services/GridService/HypergridLinker.cs
34 files changed, 554 insertions, 1733 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs index 019ca73..0188eb7 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs | |||
@@ -44,7 +44,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
44 | 44 | ||
45 | // private static readonly int PARM_PATH = 1; | 45 | // private static readonly int PARM_PATH = 1; |
46 | 46 | ||
47 | private bool enabled = false; | 47 | // private bool enabled = false; |
48 | private string qPrefix = "appearance"; | 48 | private string qPrefix = "appearance"; |
49 | 49 | ||
50 | /// <summary> | 50 | /// <summary> |
@@ -74,7 +74,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
74 | 74 | ||
75 | // Activate if everything went OK | 75 | // Activate if everything went OK |
76 | 76 | ||
77 | enabled = true; | 77 | // enabled = true; |
78 | 78 | ||
79 | Rest.Log.InfoFormat("{0} User appearance services initialization complete", MsgId); | 79 | Rest.Log.InfoFormat("{0} User appearance services initialization complete", MsgId); |
80 | } | 80 | } |
@@ -95,7 +95,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
95 | 95 | ||
96 | public void Close() | 96 | public void Close() |
97 | { | 97 | { |
98 | enabled = false; | 98 | // enabled = false; |
99 | Rest.Log.InfoFormat("{0} User appearance services closing down", MsgId); | 99 | Rest.Log.InfoFormat("{0} User appearance services closing down", MsgId); |
100 | } | 100 | } |
101 | 101 | ||
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs index c3cf08c..b415662 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs | |||
@@ -46,12 +46,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
46 | public class RestInventoryServices : IRest | 46 | public class RestInventoryServices : IRest |
47 | { | 47 | { |
48 | // private static readonly int PARM_USERID = 0; | 48 | // private static readonly int PARM_USERID = 0; |
49 | private static readonly int PARM_PATH = 1; | 49 | // private static readonly int PARM_PATH = 1; |
50 | 50 | ||
51 | // private bool enabled = false; | 51 | // private bool enabled = false; |
52 | private string qPrefix = "inventory"; | 52 | private string qPrefix = "inventory"; |
53 | 53 | ||
54 | private static readonly string PRIVATE_ROOT_NAME = "My Inventory"; | 54 | // private static readonly string PRIVATE_ROOT_NAME = "My Inventory"; |
55 | 55 | ||
56 | /// <summary> | 56 | /// <summary> |
57 | /// The constructor makes sure that the service prefix is absolute | 57 | /// The constructor makes sure that the service prefix is absolute |
diff --git a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs index d5e84c7..f138437 100644 --- a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs +++ b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs | |||
@@ -303,7 +303,7 @@ namespace OpenSim.Framework.Serialization.External | |||
303 | writer.WriteStartElement("GroupOwned"); | 303 | writer.WriteStartElement("GroupOwned"); |
304 | writer.WriteString(inventoryItem.GroupOwned.ToString()); | 304 | writer.WriteString(inventoryItem.GroupOwned.ToString()); |
305 | writer.WriteEndElement(); | 305 | writer.WriteEndElement(); |
306 | if (inventoryItem.CreatorData != null && inventoryItem.CreatorData != string.Empty) | 306 | if (options.ContainsKey("creators") && inventoryItem.CreatorData != null && inventoryItem.CreatorData != string.Empty) |
307 | writer.WriteElementString("CreatorData", inventoryItem.CreatorData); | 307 | writer.WriteElementString("CreatorData", inventoryItem.CreatorData); |
308 | else if (options.ContainsKey("profile")) | 308 | else if (options.ContainsKey("profile")) |
309 | { | 309 | { |
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index ebf7ded..5c3cad4 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs | |||
@@ -319,18 +319,21 @@ namespace OpenSim.Framework.Servers | |||
319 | return; | 319 | return; |
320 | } | 320 | } |
321 | 321 | ||
322 | string rawLevel = cmd[3]; | 322 | if (cmd.Length > 3) |
323 | 323 | { | |
324 | ILoggerRepository repository = LogManager.GetRepository(); | 324 | string rawLevel = cmd[3]; |
325 | Level consoleLevel = repository.LevelMap[rawLevel]; | 325 | |
326 | 326 | ILoggerRepository repository = LogManager.GetRepository(); | |
327 | if (consoleLevel != null) | 327 | Level consoleLevel = repository.LevelMap[rawLevel]; |
328 | m_consoleAppender.Threshold = consoleLevel; | 328 | |
329 | else | 329 | if (consoleLevel != null) |
330 | Notice( | 330 | m_consoleAppender.Threshold = consoleLevel; |
331 | String.Format( | 331 | else |
332 | "{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF", | 332 | Notice( |
333 | rawLevel)); | 333 | String.Format( |
334 | "{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF", | ||
335 | rawLevel)); | ||
336 | } | ||
334 | 337 | ||
335 | Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold)); | 338 | Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold)); |
336 | } | 339 | } |
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 96292ff..821f1a0 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -1346,6 +1346,11 @@ namespace OpenSim.Framework | |||
1346 | return (ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri; | 1346 | return (ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri; |
1347 | } | 1347 | } |
1348 | 1348 | ||
1349 | public static byte[] StringToBytes256(string str, params object[] args) | ||
1350 | { | ||
1351 | return StringToBytes256(string.Format(str, args)); | ||
1352 | } | ||
1353 | |||
1349 | public static byte[] StringToBytes256(string str) | 1354 | public static byte[] StringToBytes256(string str) |
1350 | { | 1355 | { |
1351 | if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; } | 1356 | if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; } |
@@ -1364,6 +1369,11 @@ namespace OpenSim.Framework | |||
1364 | return data; | 1369 | return data; |
1365 | } | 1370 | } |
1366 | 1371 | ||
1372 | public static byte[] StringToBytes1024(string str, params object[] args) | ||
1373 | { | ||
1374 | return StringToBytes1024(string.Format(str, args)); | ||
1375 | } | ||
1376 | |||
1367 | public static byte[] StringToBytes1024(string str) | 1377 | public static byte[] StringToBytes1024(string str) |
1368 | { | 1378 | { |
1369 | if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; } | 1379 | if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; } |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs index f1fdbc5..d6159cd 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | |||
@@ -122,6 +122,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
122 | public int PacketsReceived; | 122 | public int PacketsReceived; |
123 | /// <summary>Number of packets sent to this client</summary> | 123 | /// <summary>Number of packets sent to this client</summary> |
124 | public int PacketsSent; | 124 | public int PacketsSent; |
125 | /// <summary>Number of packets resent to this client</summary> | ||
126 | public int PacketsResent; | ||
125 | /// <summary>Total byte count of unacked packets sent to this client</summary> | 127 | /// <summary>Total byte count of unacked packets sent to this client</summary> |
126 | public int UnackedBytes; | 128 | public int UnackedBytes; |
127 | 129 | ||
@@ -257,9 +259,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
257 | public string GetStats() | 259 | public string GetStats() |
258 | { | 260 | { |
259 | return string.Format( | 261 | return string.Format( |
260 | "{0,7} {1,7} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}", | 262 | "{0,7} {1,7} {2,7} {3,9} {4,7} {5,7} {6,7} {7,7} {8,7} {9,8} {10,7} {11,7}", |
263 | PacketsReceived, | ||
261 | PacketsSent, | 264 | PacketsSent, |
262 | PacketsReceived, | 265 | PacketsResent, |
263 | UnackedBytes, | 266 | UnackedBytes, |
264 | m_packetOutboxes[(int)ThrottleOutPacketType.Resend].Count, | 267 | m_packetOutboxes[(int)ThrottleOutPacketType.Resend].Count, |
265 | m_packetOutboxes[(int)ThrottleOutPacketType.Land].Count, | 268 | m_packetOutboxes[(int)ThrottleOutPacketType.Land].Count, |
@@ -449,13 +452,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
449 | /// an outgoing packet from each, obeying the throttling bucket limits | 452 | /// an outgoing packet from each, obeying the throttling bucket limits |
450 | /// </summary> | 453 | /// </summary> |
451 | /// | 454 | /// |
455 | /// <remarks> | ||
452 | /// Packet queues are inspected in ascending numerical order starting from 0. Therefore, queues with a lower | 456 | /// Packet queues are inspected in ascending numerical order starting from 0. Therefore, queues with a lower |
453 | /// ThrottleOutPacketType number will see their packet get sent first (e.g. if both Land and Wind queues have | 457 | /// ThrottleOutPacketType number will see their packet get sent first (e.g. if both Land and Wind queues have |
454 | /// packets, then the packet at the front of the Land queue will be sent before the packet at the front of the | 458 | /// packets, then the packet at the front of the Land queue will be sent before the packet at the front of the |
455 | /// wind queue). | 459 | /// wind queue). |
456 | /// | 460 | /// |
457 | /// <remarks>This function is only called from a synchronous loop in the | 461 | /// This function is only called from a synchronous loop in the |
458 | /// UDPServer so we don't need to bother making this thread safe</remarks> | 462 | /// UDPServer so we don't need to bother making this thread safe |
463 | /// </remarks> | ||
464 | /// | ||
459 | /// <returns>True if any packets were sent, otherwise false</returns> | 465 | /// <returns>True if any packets were sent, otherwise false</returns> |
460 | public bool DequeueOutgoing() | 466 | public bool DequeueOutgoing() |
461 | { | 467 | { |
@@ -486,7 +492,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
486 | m_udpServer.SendPacketFinal(nextPacket); | 492 | m_udpServer.SendPacketFinal(nextPacket); |
487 | m_nextPackets[i] = null; | 493 | m_nextPackets[i] = null; |
488 | packetSent = true; | 494 | packetSent = true; |
489 | this.PacketsSent++; | ||
490 | } | 495 | } |
491 | } | 496 | } |
492 | else | 497 | else |
@@ -503,7 +508,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
503 | // Send the packet | 508 | // Send the packet |
504 | m_udpServer.SendPacketFinal(packet); | 509 | m_udpServer.SendPacketFinal(packet); |
505 | packetSent = true; | 510 | packetSent = true; |
506 | this.PacketsSent++; | ||
507 | } | 511 | } |
508 | else | 512 | else |
509 | { | 513 | { |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 703176c..cfcc057 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | |||
@@ -506,7 +506,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
506 | 506 | ||
507 | // Bump up the resend count on this packet | 507 | // Bump up the resend count on this packet |
508 | Interlocked.Increment(ref outgoingPacket.ResendCount); | 508 | Interlocked.Increment(ref outgoingPacket.ResendCount); |
509 | //Interlocked.Increment(ref Stats.ResentPackets); | ||
510 | 509 | ||
511 | // Requeue or resend the packet | 510 | // Requeue or resend the packet |
512 | if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, false)) | 511 | if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, false)) |
@@ -582,6 +581,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
582 | udpClient.NeedAcks.Add(outgoingPacket); | 581 | udpClient.NeedAcks.Add(outgoingPacket); |
583 | } | 582 | } |
584 | } | 583 | } |
584 | else | ||
585 | { | ||
586 | Interlocked.Increment(ref udpClient.PacketsResent); | ||
587 | } | ||
585 | 588 | ||
586 | #endregion Sequence Number Assignment | 589 | #endregion Sequence Number Assignment |
587 | 590 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs index 6fb8b46..df4d561 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs | |||
@@ -245,14 +245,12 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps | |||
245 | WriteTextureData(httpRequest, httpResponse, texture, format); | 245 | WriteTextureData(httpRequest, httpResponse, texture, format); |
246 | return true; | 246 | return true; |
247 | } | 247 | } |
248 | |||
249 | } | 248 | } |
250 | 249 | ||
251 | // not found | 250 | // not found |
252 | m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found"); | 251 | // m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found"); |
253 | httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; | 252 | httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; |
254 | return true; | 253 | return true; |
255 | |||
256 | } | 254 | } |
257 | 255 | ||
258 | private void WriteTextureData(OSHttpRequest request, OSHttpResponse response, AssetBase texture, string format) | 256 | private void WriteTextureData(OSHttpRequest request, OSHttpResponse response, AssetBase texture, string format) |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index b1c2a3c..68538c9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | |||
@@ -128,6 +128,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
128 | + "<last> is the user's last name." + Environment.NewLine | 128 | + "<last> is the user's last name." + Environment.NewLine |
129 | + "<inventory path> is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine | 129 | + "<inventory path> is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine |
130 | + "-p|--profile=<url> adds the url of the profile service to the saved user information." + Environment.NewLine | 130 | + "-p|--profile=<url> adds the url of the profile service to the saved user information." + Environment.NewLine |
131 | <<<<<<< HEAD:OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | ||
132 | ======= | ||
133 | + "-c|--creators preserves information about foreign creators." + Environment.NewLine | ||
134 | + "-v|--verbose extra debug messages." + Environment.NewLine | ||
135 | >>>>>>> master:OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | ||
131 | + "<IAR path> is the filesystem path at which to save the IAR." | 136 | + "<IAR path> is the filesystem path at which to save the IAR." |
132 | + string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME), | 137 | + string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME), |
133 | HandleSaveInvConsoleCommand); | 138 | HandleSaveInvConsoleCommand); |
@@ -394,6 +399,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
394 | OptionSet ops = new OptionSet(); | 399 | OptionSet ops = new OptionSet(); |
395 | //ops.Add("v|version=", delegate(string v) { options["version"] = v; }); | 400 | //ops.Add("v|version=", delegate(string v) { options["version"] = v; }); |
396 | ops.Add("p|profile=", delegate(string v) { options["profile"] = v; }); | 401 | ops.Add("p|profile=", delegate(string v) { options["profile"] = v; }); |
402 | <<<<<<< HEAD:OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | ||
403 | ======= | ||
404 | ops.Add("v|verbose", delegate(string v) { options["verbose"] = v; }); | ||
405 | ops.Add("c|creators", delegate(string v) { options["creators"] = v; }); | ||
406 | >>>>>>> master:OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | ||
397 | 407 | ||
398 | List<string> mainParams = ops.Parse(cmdparams); | 408 | List<string> mainParams = ops.Parse(cmdparams); |
399 | 409 | ||
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 9e1d414..ca29a7c 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -1006,7 +1006,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1006 | /// </summary> | 1006 | /// </summary> |
1007 | public void EnableChildAgent(ScenePresence sp, GridRegion region) | 1007 | public void EnableChildAgent(ScenePresence sp, GridRegion region) |
1008 | { | 1008 | { |
1009 | m_log.DebugFormat("[ENTITY TRANSFER]: Enabling child agent in new neighour {0}", region.RegionName); | 1009 | m_log.DebugFormat("[ENTITY TRANSFER]: Enabling child agent in new neighbour {0}", region.RegionName); |
1010 | 1010 | ||
1011 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | 1011 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); |
1012 | AgentCircuitData agent = sp.ControllingClient.RequestClientInfo(); | 1012 | AgentCircuitData agent = sp.ControllingClient.RequestClientInfo(); |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index 34b8114..4565d10 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs | |||
@@ -55,6 +55,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
55 | } | 55 | } |
56 | 56 | ||
57 | private string m_ProfileServerURI; | 57 | private string m_ProfileServerURI; |
58 | private bool m_OutboundPermission; | ||
58 | 59 | ||
59 | // private bool m_Initialized = false; | 60 | // private bool m_Initialized = false; |
60 | 61 | ||
@@ -78,7 +79,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
78 | 79 | ||
79 | IConfig thisModuleConfig = source.Configs["HGInventoryAccessModule"]; | 80 | IConfig thisModuleConfig = source.Configs["HGInventoryAccessModule"]; |
80 | if (thisModuleConfig != null) | 81 | if (thisModuleConfig != null) |
82 | { | ||
81 | m_ProfileServerURI = thisModuleConfig.GetString("ProfileServerURI", string.Empty); | 83 | m_ProfileServerURI = thisModuleConfig.GetString("ProfileServerURI", string.Empty); |
84 | m_OutboundPermission = thisModuleConfig.GetBoolean("OutboundPermission", true); | ||
85 | } | ||
82 | else | 86 | else |
83 | m_log.Warn("[HG INVENTORY ACCESS MODULE]: HGInventoryAccessModule configs not found. ProfileServerURI not set!"); | 87 | m_log.Warn("[HG INVENTORY ACCESS MODULE]: HGInventoryAccessModule configs not found. ProfileServerURI not set!"); |
84 | } | 88 | } |
@@ -103,7 +107,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
103 | public void UploadInventoryItem(UUID avatarID, UUID assetID, string name, int userlevel) | 107 | public void UploadInventoryItem(UUID avatarID, UUID assetID, string name, int userlevel) |
104 | { | 108 | { |
105 | string userAssetServer = string.Empty; | 109 | string userAssetServer = string.Empty; |
106 | if (IsForeignUser(avatarID, out userAssetServer)) | 110 | if (IsForeignUser(avatarID, out userAssetServer) && m_OutboundPermission) |
107 | { | 111 | { |
108 | Util.FireAndForget(delegate { m_assMapper.Post(assetID, avatarID, userAssetServer); }); | 112 | Util.FireAndForget(delegate { m_assMapper.Post(assetID, avatarID, userAssetServer); }); |
109 | } | 113 | } |
@@ -197,7 +201,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
197 | if (IsForeignUser(sender, out userAssetServer)) | 201 | if (IsForeignUser(sender, out userAssetServer)) |
198 | m_assMapper.Get(item.AssetID, sender, userAssetServer); | 202 | m_assMapper.Get(item.AssetID, sender, userAssetServer); |
199 | 203 | ||
200 | if (IsForeignUser(receiver, out userAssetServer)) | 204 | if (IsForeignUser(receiver, out userAssetServer) && m_OutboundPermission) |
201 | m_assMapper.Post(item.AssetID, receiver, userAssetServer); | 205 | m_assMapper.Post(item.AssetID, receiver, userAssetServer); |
202 | } | 206 | } |
203 | 207 | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 39410b5..3f63db3 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | |||
@@ -200,6 +200,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
200 | return; | 200 | return; |
201 | } | 201 | } |
202 | } | 202 | } |
203 | else | ||
204 | { | ||
205 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: User {0} does not have InventoryServerURI. OH NOES!", userID); | ||
206 | return; | ||
207 | } | ||
203 | } | 208 | } |
204 | } | 209 | } |
205 | } | 210 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs deleted file mode 100644 index 9213132..0000000 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs +++ /dev/null | |||
@@ -1,362 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using log4net; | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | using Nini.Config; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Statistics; | ||
35 | using OpenSim.Services.Connectors; | ||
36 | using OpenSim.Region.Framework.Interfaces; | ||
37 | using OpenSim.Region.Framework.Scenes; | ||
38 | using OpenSim.Services.Interfaces; | ||
39 | using OpenMetaverse; | ||
40 | |||
41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | ||
42 | { | ||
43 | public class RemoteInventoryServicesConnector : BaseInventoryConnector, ISharedRegionModule, IInventoryService | ||
44 | { | ||
45 | private static readonly ILog m_log = | ||
46 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
47 | |||
48 | private bool m_Enabled = false; | ||
49 | private bool m_Initialized = false; | ||
50 | private Scene m_Scene; | ||
51 | private InventoryServicesConnector m_RemoteConnector; | ||
52 | |||
53 | private IUserManagement m_UserManager; | ||
54 | private IUserManagement UserManager | ||
55 | { | ||
56 | get | ||
57 | { | ||
58 | if (m_UserManager == null) | ||
59 | { | ||
60 | m_UserManager = m_Scene.RequestModuleInterface<IUserManagement>(); | ||
61 | } | ||
62 | return m_UserManager; | ||
63 | } | ||
64 | } | ||
65 | |||
66 | |||
67 | public Type ReplaceableInterface | ||
68 | { | ||
69 | get { return null; } | ||
70 | } | ||
71 | |||
72 | public string Name | ||
73 | { | ||
74 | get { return "RemoteInventoryServicesConnector"; } | ||
75 | } | ||
76 | |||
77 | public RemoteInventoryServicesConnector() | ||
78 | { | ||
79 | } | ||
80 | |||
81 | public RemoteInventoryServicesConnector(IConfigSource source) | ||
82 | { | ||
83 | Init(source); | ||
84 | } | ||
85 | |||
86 | protected override void Init(IConfigSource source) | ||
87 | { | ||
88 | m_RemoteConnector = new InventoryServicesConnector(source); | ||
89 | base.Init(source); | ||
90 | } | ||
91 | |||
92 | #region ISharedRegionModule | ||
93 | |||
94 | public void Initialise(IConfigSource source) | ||
95 | { | ||
96 | IConfig moduleConfig = source.Configs["Modules"]; | ||
97 | if (moduleConfig != null) | ||
98 | { | ||
99 | string name = moduleConfig.GetString("InventoryServices", ""); | ||
100 | if (name == Name) | ||
101 | { | ||
102 | Init(source); | ||
103 | m_Enabled = true; | ||
104 | |||
105 | m_log.Info("[INVENTORY CONNECTOR]: Remote inventory enabled"); | ||
106 | } | ||
107 | } | ||
108 | } | ||
109 | |||
110 | public void PostInitialise() | ||
111 | { | ||
112 | } | ||
113 | |||
114 | public void Close() | ||
115 | { | ||
116 | } | ||
117 | |||
118 | public void AddRegion(Scene scene) | ||
119 | { | ||
120 | // m_Scene = scene; | ||
121 | //m_log.Debug("[XXXX] Adding scene " + m_Scene.RegionInfo.RegionName); | ||
122 | |||
123 | if (!m_Enabled) | ||
124 | return; | ||
125 | |||
126 | if (!m_Initialized) | ||
127 | { | ||
128 | m_Initialized = true; | ||
129 | } | ||
130 | |||
131 | scene.RegisterModuleInterface<IInventoryService>(this); | ||
132 | m_cache.AddRegion(scene); | ||
133 | |||
134 | if (m_Scene == null) | ||
135 | m_Scene = scene; | ||
136 | } | ||
137 | |||
138 | public void RemoveRegion(Scene scene) | ||
139 | { | ||
140 | if (!m_Enabled) | ||
141 | return; | ||
142 | |||
143 | m_cache.RemoveRegion(scene); | ||
144 | } | ||
145 | |||
146 | public void RegionLoaded(Scene scene) | ||
147 | { | ||
148 | if (!m_Enabled) | ||
149 | return; | ||
150 | |||
151 | m_log.InfoFormat("[INVENTORY CONNECTOR]: Enabled remote inventory for region {0}", scene.RegionInfo.RegionName); | ||
152 | |||
153 | } | ||
154 | |||
155 | #endregion ISharedRegionModule | ||
156 | |||
157 | #region IInventoryService | ||
158 | |||
159 | public override bool CreateUserInventory(UUID user) | ||
160 | { | ||
161 | return false; | ||
162 | } | ||
163 | |||
164 | public override List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | ||
165 | { | ||
166 | return new List<InventoryFolderBase>(); | ||
167 | } | ||
168 | |||
169 | public override InventoryCollection GetUserInventory(UUID userID) | ||
170 | { | ||
171 | return null; | ||
172 | } | ||
173 | |||
174 | public override void GetUserInventory(UUID userID, InventoryReceiptCallback callback) | ||
175 | { | ||
176 | UUID sessionID = GetSessionID(userID); | ||
177 | try | ||
178 | { | ||
179 | m_RemoteConnector.GetUserInventory(userID.ToString(), sessionID, callback); | ||
180 | } | ||
181 | catch (Exception e) | ||
182 | { | ||
183 | if (StatsManager.SimExtraStats != null) | ||
184 | StatsManager.SimExtraStats.AddInventoryServiceRetrievalFailure(); | ||
185 | |||
186 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: Request inventory operation failed, {0} {1}", | ||
187 | e.Source, e.Message); | ||
188 | } | ||
189 | |||
190 | } | ||
191 | |||
192 | // inherited. See base class | ||
193 | // public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | ||
194 | |||
195 | public override Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID) | ||
196 | { | ||
197 | UUID sessionID = GetSessionID(userID); | ||
198 | return m_RemoteConnector.GetSystemFolders(userID.ToString(), sessionID); | ||
199 | } | ||
200 | |||
201 | public override InventoryCollection GetFolderContent(UUID userID, UUID folderID) | ||
202 | { | ||
203 | UUID sessionID = GetSessionID(userID); | ||
204 | try | ||
205 | { | ||
206 | InventoryCollection invCol = m_RemoteConnector.GetFolderContent(userID.ToString(), folderID, sessionID); | ||
207 | foreach (InventoryItemBase item in invCol.Items) | ||
208 | UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData); | ||
209 | return invCol; | ||
210 | } | ||
211 | catch (Exception e) | ||
212 | { | ||
213 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderContent operation failed, {0} {1}", | ||
214 | e.Source, e.Message); | ||
215 | } | ||
216 | InventoryCollection nullCollection = new InventoryCollection(); | ||
217 | nullCollection.Folders = new List<InventoryFolderBase>(); | ||
218 | nullCollection.Items = new List<InventoryItemBase>(); | ||
219 | nullCollection.UserID = userID; | ||
220 | return nullCollection; | ||
221 | } | ||
222 | |||
223 | public override List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | ||
224 | { | ||
225 | UUID sessionID = GetSessionID(userID); | ||
226 | return m_RemoteConnector.GetFolderItems(userID.ToString(), folderID, sessionID); | ||
227 | } | ||
228 | |||
229 | public override bool AddFolder(InventoryFolderBase folder) | ||
230 | { | ||
231 | if (folder == null) | ||
232 | return false; | ||
233 | |||
234 | UUID sessionID = GetSessionID(folder.Owner); | ||
235 | return m_RemoteConnector.AddFolder(folder.Owner.ToString(), folder, sessionID); | ||
236 | } | ||
237 | |||
238 | public override bool UpdateFolder(InventoryFolderBase folder) | ||
239 | { | ||
240 | if (folder == null) | ||
241 | return false; | ||
242 | |||
243 | UUID sessionID = GetSessionID(folder.Owner); | ||
244 | return m_RemoteConnector.UpdateFolder(folder.Owner.ToString(), folder, sessionID); | ||
245 | } | ||
246 | |||
247 | public override bool MoveFolder(InventoryFolderBase folder) | ||
248 | { | ||
249 | if (folder == null) | ||
250 | return false; | ||
251 | |||
252 | UUID sessionID = GetSessionID(folder.Owner); | ||
253 | return m_RemoteConnector.MoveFolder(folder.Owner.ToString(), folder, sessionID); | ||
254 | } | ||
255 | |||
256 | public override bool DeleteFolders(UUID ownerID, List<UUID> folderIDs) | ||
257 | { | ||
258 | if (folderIDs == null) | ||
259 | return false; | ||
260 | if (folderIDs.Count == 0) | ||
261 | return false; | ||
262 | |||
263 | UUID sessionID = GetSessionID(ownerID); | ||
264 | return m_RemoteConnector.DeleteFolders(ownerID.ToString(), folderIDs, sessionID); | ||
265 | } | ||
266 | |||
267 | |||
268 | public override bool PurgeFolder(InventoryFolderBase folder) | ||
269 | { | ||
270 | if (folder == null) | ||
271 | return false; | ||
272 | |||
273 | UUID sessionID = GetSessionID(folder.Owner); | ||
274 | return m_RemoteConnector.PurgeFolder(folder.Owner.ToString(), folder, sessionID); | ||
275 | } | ||
276 | |||
277 | // public bool AddItem(InventoryItemBase item) inherited | ||
278 | // Uses AddItemPlain | ||
279 | |||
280 | protected override bool AddItemPlain(InventoryItemBase item) | ||
281 | { | ||
282 | if (item == null) | ||
283 | return false; | ||
284 | |||
285 | UUID sessionID = GetSessionID(item.Owner); | ||
286 | return m_RemoteConnector.AddItem(item.Owner.ToString(), item, sessionID); | ||
287 | } | ||
288 | |||
289 | public override bool UpdateItem(InventoryItemBase item) | ||
290 | { | ||
291 | if (item == null) | ||
292 | return false; | ||
293 | |||
294 | UUID sessionID = GetSessionID(item.Owner); | ||
295 | return m_RemoteConnector.UpdateItem(item.Owner.ToString(), item, sessionID); | ||
296 | } | ||
297 | |||
298 | public override bool MoveItems(UUID ownerID, List<InventoryItemBase> items) | ||
299 | { | ||
300 | if (items == null) | ||
301 | return false; | ||
302 | |||
303 | UUID sessionID = GetSessionID(ownerID); | ||
304 | return m_RemoteConnector.MoveItems(ownerID.ToString(), items, sessionID); | ||
305 | } | ||
306 | |||
307 | |||
308 | public override bool DeleteItems(UUID ownerID, List<UUID> itemIDs) | ||
309 | { | ||
310 | if (itemIDs == null) | ||
311 | return false; | ||
312 | if (itemIDs.Count == 0) | ||
313 | return true; | ||
314 | |||
315 | UUID sessionID = GetSessionID(ownerID); | ||
316 | return m_RemoteConnector.DeleteItems(ownerID.ToString(), itemIDs, sessionID); | ||
317 | } | ||
318 | |||
319 | public override InventoryItemBase GetItem(InventoryItemBase item) | ||
320 | { | ||
321 | if (item == null) | ||
322 | return null; | ||
323 | |||
324 | UUID sessionID = GetSessionID(item.Owner); | ||
325 | return m_RemoteConnector.QueryItem(item.Owner.ToString(), item, sessionID); | ||
326 | } | ||
327 | |||
328 | public override InventoryFolderBase GetFolder(InventoryFolderBase folder) | ||
329 | { | ||
330 | if (folder == null) | ||
331 | return null; | ||
332 | |||
333 | UUID sessionID = GetSessionID(folder.Owner); | ||
334 | return m_RemoteConnector.QueryFolder(folder.Owner.ToString(), folder, sessionID); | ||
335 | } | ||
336 | |||
337 | public override bool HasInventoryForUser(UUID userID) | ||
338 | { | ||
339 | return false; | ||
340 | } | ||
341 | |||
342 | public override List<InventoryItemBase> GetActiveGestures(UUID userId) | ||
343 | { | ||
344 | return new List<InventoryItemBase>(); | ||
345 | } | ||
346 | |||
347 | public override int GetAssetPermissions(UUID userID, UUID assetID) | ||
348 | { | ||
349 | UUID sessionID = GetSessionID(userID); | ||
350 | return m_RemoteConnector.GetAssetPermissions(userID.ToString(), assetID, sessionID); | ||
351 | } | ||
352 | |||
353 | |||
354 | #endregion | ||
355 | |||
356 | private UUID GetSessionID(UUID userID) | ||
357 | { | ||
358 | return UUID.Zero; | ||
359 | } | ||
360 | |||
361 | } | ||
362 | } | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index 971a56f..9363714 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs | |||
@@ -225,17 +225,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
225 | if (destination == null) | 225 | if (destination == null) |
226 | return false; | 226 | return false; |
227 | 227 | ||
228 | // We limit the number of messages sent for a position change to just one per | ||
229 | // simulator so when we receive the update we need to hand it to each of the | ||
230 | // scenes; scenes each check to see if the is a scene presence for the avatar | ||
231 | // note that we really don't need the GridRegion for this call | ||
228 | foreach (Scene s in m_sceneList) | 232 | foreach (Scene s in m_sceneList) |
229 | { | 233 | { |
230 | if (s.RegionInfo.RegionHandle == destination.RegionHandle) | 234 | //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); |
231 | { | 235 | s.IncomingChildAgentDataUpdate(cAgentData); |
232 | //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); | ||
233 | s.IncomingChildAgentDataUpdate(cAgentData); | ||
234 | return true; | ||
235 | } | ||
236 | } | 236 | } |
237 | //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate"); | 237 | //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate"); |
238 | return false; | 238 | return true; |
239 | } | 239 | } |
240 | 240 | ||
241 | public bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent) | 241 | public bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index c8af4c3..19cb0c1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -189,7 +189,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
189 | } | 189 | } |
190 | } | 190 | } |
191 | 191 | ||
192 | public delegate void SendChildAgentDataUpdateDelegate(AgentPosition cAgentData, UUID scopeID, ulong regionHandle); | 192 | public delegate void SendChildAgentDataUpdateDelegate(AgentPosition cAgentData, UUID scopeID, GridRegion dest); |
193 | |||
193 | 194 | ||
194 | /// <summary> | 195 | /// <summary> |
195 | /// This informs all neighboring regions about the settings of it's child agent. | 196 | /// This informs all neighboring regions about the settings of it's child agent. |
@@ -198,31 +199,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
198 | /// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc. | 199 | /// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc. |
199 | /// | 200 | /// |
200 | /// </summary> | 201 | /// </summary> |
201 | private void SendChildAgentDataUpdateAsync(AgentPosition cAgentData, UUID scopeID, ulong regionHandle) | 202 | private void SendChildAgentDataUpdateAsync(AgentPosition cAgentData, UUID scopeID, GridRegion dest) |
202 | { | 203 | { |
203 | //m_log.Info("[INTERGRID]: Informing neighbors about my agent in " + m_regionInfo.RegionName); | 204 | //m_log.Info("[INTERGRID]: Informing neighbors about my agent in " + m_regionInfo.RegionName); |
204 | try | 205 | try |
205 | { | 206 | { |
206 | //m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData); | 207 | m_scene.SimulationService.UpdateAgent(dest, cAgentData); |
207 | uint x = 0, y = 0; | ||
208 | Utils.LongToUInts(regionHandle, out x, out y); | ||
209 | GridRegion destination = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); | ||
210 | m_scene.SimulationService.UpdateAgent(destination, cAgentData); | ||
211 | } | 208 | } |
212 | catch | 209 | catch |
213 | { | 210 | { |
214 | // Ignore; we did our best | 211 | // Ignore; we did our best |
215 | } | 212 | } |
216 | |||
217 | //if (regionAccepted) | ||
218 | //{ | ||
219 | // //m_log.Info("[INTERGRID]: Completed sending a neighbor an update about my agent"); | ||
220 | //} | ||
221 | //else | ||
222 | //{ | ||
223 | // //m_log.Info("[INTERGRID]: Failed sending a neighbor an update about my agent"); | ||
224 | //} | ||
225 | |||
226 | } | 213 | } |
227 | 214 | ||
228 | private void SendChildAgentDataUpdateCompleted(IAsyncResult iar) | 215 | private void SendChildAgentDataUpdateCompleted(IAsyncResult iar) |
@@ -236,14 +223,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
236 | // This assumes that we know what our neighbors are. | 223 | // This assumes that we know what our neighbors are. |
237 | try | 224 | try |
238 | { | 225 | { |
226 | uint x = 0, y = 0; | ||
227 | List<string> simulatorList = new List<string>(); | ||
239 | foreach (ulong regionHandle in presence.KnownChildRegionHandles) | 228 | foreach (ulong regionHandle in presence.KnownChildRegionHandles) |
240 | { | 229 | { |
241 | if (regionHandle != m_regionInfo.RegionHandle) | 230 | if (regionHandle != m_regionInfo.RegionHandle) |
242 | { | 231 | { |
243 | SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync; | 232 | // we only want to send one update to each simulator; the simulator will |
244 | d.BeginInvoke(cAgentData, m_regionInfo.ScopeID, regionHandle, | 233 | // hand it off to the regions where a child agent exists, this does assume |
245 | SendChildAgentDataUpdateCompleted, | 234 | // that the region position is cached or performance will degrade |
246 | d); | 235 | Utils.LongToUInts(regionHandle, out x, out y); |
236 | GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); | ||
237 | if (! simulatorList.Contains(dest.ServerURI)) | ||
238 | { | ||
239 | // we havent seen this simulator before, add it to the list | ||
240 | // and send it an update | ||
241 | simulatorList.Add(dest.ServerURI); | ||
242 | |||
243 | SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync; | ||
244 | d.BeginInvoke(cAgentData, m_regionInfo.ScopeID, dest, | ||
245 | SendChildAgentDataUpdateCompleted, | ||
246 | d); | ||
247 | } | ||
247 | } | 248 | } |
248 | } | 249 | } |
249 | } | 250 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 6496a25..d4f3dfe 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -2093,8 +2093,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2093 | 2093 | ||
2094 | public void GetProperties(IClientAPI client) | 2094 | public void GetProperties(IClientAPI client) |
2095 | { | 2095 | { |
2096 | //Viewer wants date in microseconds so multiply it by 1,000,000. | ||
2096 | client.SendObjectPropertiesReply( | 2097 | client.SendObjectPropertiesReply( |
2097 | m_fromUserInventoryItemID, (ulong)_creationDate, _creatorID, UUID.Zero, UUID.Zero, | 2098 | m_fromUserInventoryItemID, (ulong)_creationDate*(ulong)1e6, _creatorID, UUID.Zero, UUID.Zero, |
2098 | _groupID, (short)InventorySerial, _lastOwnerID, UUID, _ownerID, | 2099 | _groupID, (short)InventorySerial, _lastOwnerID, UUID, _ownerID, |
2099 | ParentGroup.RootPart.TouchName, new byte[0], ParentGroup.RootPart.SitName, Name, Description, | 2100 | ParentGroup.RootPart.TouchName, new byte[0], ParentGroup.RootPart.SitName, Name, Description, |
2100 | ParentGroup.RootPart._ownerMask, ParentGroup.RootPart._nextOwnerMask, ParentGroup.RootPart._groupMask, ParentGroup.RootPart._everyoneMask, | 2101 | ParentGroup.RootPart._ownerMask, ParentGroup.RootPart._nextOwnerMask, ParentGroup.RootPart._groupMask, ParentGroup.RootPart._everyoneMask, |
diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs index 87d067c..6630edb 100644 --- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs | |||
@@ -154,24 +154,26 @@ namespace OpenSim.Region.CoreModules.UDP.Linden | |||
154 | report.Append(GetColumnEntry("Type", maxTypeLength, columnPadding)); | 154 | report.Append(GetColumnEntry("Type", maxTypeLength, columnPadding)); |
155 | 155 | ||
156 | report.AppendFormat( | 156 | report.AppendFormat( |
157 | "{0,7} {1,7} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}\n", | 157 | "{0,7} {1,7} {2,7} {3,9} {4,7} {5,7} {6,7} {7,7} {8,7} {9,8} {10,7} {11,7}\n", |
158 | "Pkts", | 158 | "Pkts", |
159 | "Pkts", | 159 | "Pkts", |
160 | "Pkts", | ||
160 | "Bytes", | 161 | "Bytes", |
161 | "Pkts", | 162 | "Q Pkts", |
162 | "Pkts", | 163 | "Q Pkts", |
163 | "Pkts", | 164 | "Q Pkts", |
164 | "Pkts", | 165 | "Q Pkts", |
165 | "Pkts", | 166 | "Q Pkts", |
166 | "Pkts", | 167 | "Q Pkts", |
167 | "Pkts", | 168 | "Q Pkts", |
168 | "Pkts"); | 169 | "Q Pkts"); |
169 | 170 | ||
170 | report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", ""); | 171 | report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", ""); |
171 | report.AppendFormat( | 172 | report.AppendFormat( |
172 | "{0,7} {1,7} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}\n", | 173 | "{0,7} {1,7} {2,7} {3,9} {4,7} {5,7} {6,7} {7,7} {8,7} {9,8} {10,7} {11,7}\n", |
173 | "Out", | ||
174 | "In", | 174 | "In", |
175 | "Out", | ||
176 | "Resent", | ||
175 | "Unacked", | 177 | "Unacked", |
176 | "Resend", | 178 | "Resend", |
177 | "Land", | 179 | "Land", |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs index 5c779de..6d26075 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs | |||
@@ -63,7 +63,26 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
63 | void SetAgentActiveGroupRole(UUID RequestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID); | 63 | void SetAgentActiveGroupRole(UUID RequestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID); |
64 | void SetAgentGroupInfo(UUID RequestingAgentID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile); | 64 | void SetAgentGroupInfo(UUID RequestingAgentID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile); |
65 | 65 | ||
66 | /// <summary> | ||
67 | /// Get information about a specific group to which the user belongs. | ||
68 | /// </summary> | ||
69 | /// <param name="RequestingAgentID">The agent requesting the information.</param> | ||
70 | /// <param name="AgentID">The agent requested.</param> | ||
71 | /// <param name="GroupID">The group requested.</param> | ||
72 | /// <returns> | ||
73 | /// If the user is a member of the group then the data structure is returned. If not, then null is returned. | ||
74 | /// </returns> | ||
66 | GroupMembershipData GetAgentGroupMembership(UUID RequestingAgentID, UUID AgentID, UUID GroupID); | 75 | GroupMembershipData GetAgentGroupMembership(UUID RequestingAgentID, UUID AgentID, UUID GroupID); |
76 | |||
77 | /// <summary> | ||
78 | /// Get information about the groups to which a user belongs. | ||
79 | /// </summary> | ||
80 | /// <param name="RequestingAgentID">The agent requesting the information.</param> | ||
81 | /// <param name="AgentID">The agent requested.</param> | ||
82 | /// <returns> | ||
83 | /// Information about the groups to which the user belongs. If the user belongs to no groups then an empty | ||
84 | /// list is returned. | ||
85 | /// </returns> | ||
67 | List<GroupMembershipData> GetAgentGroupMemberships(UUID RequestingAgentID, UUID AgentID); | 86 | List<GroupMembershipData> GetAgentGroupMemberships(UUID RequestingAgentID, UUID AgentID); |
68 | 87 | ||
69 | void AddGroupNotice(UUID RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket); | 88 | void AddGroupNotice(UUID RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket); |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs index 0d265f2..81725c5 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs | |||
@@ -704,7 +704,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
704 | } | 704 | } |
705 | } | 705 | } |
706 | 706 | ||
707 | |||
708 | return findings; | 707 | return findings; |
709 | } | 708 | } |
710 | 709 | ||
@@ -712,54 +711,55 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
712 | { | 711 | { |
713 | if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 712 | if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
714 | 713 | ||
715 | GroupMembershipData data = new GroupMembershipData(); | 714 | GroupMembershipData data = null; |
716 | 715 | bool foundData = false; | |
717 | /////////////////////////////// | ||
718 | // Agent Specific Information: | ||
719 | // | ||
720 | OSDMap UserActiveGroup; | ||
721 | if (SimianGetGenericEntry(agentID, "Group", "ActiveGroup", out UserActiveGroup)) | ||
722 | { | ||
723 | data.Active = UserActiveGroup["GroupID"].AsUUID().Equals(groupID); | ||
724 | } | ||
725 | 716 | ||
726 | OSDMap UserGroupMemberInfo; | 717 | OSDMap UserGroupMemberInfo; |
727 | if (SimianGetGenericEntry(agentID, "GroupMember", groupID.ToString(), out UserGroupMemberInfo)) | 718 | if (SimianGetGenericEntry(agentID, "GroupMember", groupID.ToString(), out UserGroupMemberInfo)) |
728 | { | 719 | { |
720 | data = new GroupMembershipData(); | ||
729 | data.AcceptNotices = UserGroupMemberInfo["AcceptNotices"].AsBoolean(); | 721 | data.AcceptNotices = UserGroupMemberInfo["AcceptNotices"].AsBoolean(); |
730 | data.Contribution = UserGroupMemberInfo["Contribution"].AsInteger(); | 722 | data.Contribution = UserGroupMemberInfo["Contribution"].AsInteger(); |
731 | data.ListInProfile = UserGroupMemberInfo["ListInProfile"].AsBoolean(); | 723 | data.ListInProfile = UserGroupMemberInfo["ListInProfile"].AsBoolean(); |
732 | data.ActiveRole = UserGroupMemberInfo["SelectedRoleID"].AsUUID(); | 724 | data.ActiveRole = UserGroupMemberInfo["SelectedRoleID"].AsUUID(); |
725 | |||
726 | /////////////////////////////// | ||
727 | // Agent Specific Information: | ||
728 | // | ||
729 | OSDMap UserActiveGroup; | ||
730 | if (SimianGetGenericEntry(agentID, "Group", "ActiveGroup", out UserActiveGroup)) | ||
731 | { | ||
732 | data.Active = UserActiveGroup["GroupID"].AsUUID().Equals(groupID); | ||
733 | } | ||
733 | 734 | ||
734 | /////////////////////////////// | 735 | /////////////////////////////// |
735 | // Role Specific Information: | 736 | // Role Specific Information: |
736 | // | 737 | // |
737 | |||
738 | OSDMap GroupRoleInfo; | 738 | OSDMap GroupRoleInfo; |
739 | if (SimianGetGenericEntry(groupID, "GroupRole", data.ActiveRole.ToString(), out GroupRoleInfo)) | 739 | if (SimianGetGenericEntry(groupID, "GroupRole", data.ActiveRole.ToString(), out GroupRoleInfo)) |
740 | { | 740 | { |
741 | data.GroupTitle = GroupRoleInfo["Title"].AsString(); | 741 | data.GroupTitle = GroupRoleInfo["Title"].AsString(); |
742 | data.GroupPowers = GroupRoleInfo["Powers"].AsULong(); | 742 | data.GroupPowers = GroupRoleInfo["Powers"].AsULong(); |
743 | } | 743 | } |
744 | } | 744 | |
745 | 745 | /////////////////////////////// | |
746 | /////////////////////////////// | 746 | // Group Specific Information: |
747 | // Group Specific Information: | 747 | // |
748 | // | 748 | OSDMap GroupInfo; |
749 | OSDMap GroupInfo; | 749 | string GroupName; |
750 | string GroupName; | 750 | if (SimianGetFirstGenericEntry(groupID, "Group", out GroupName, out GroupInfo)) |
751 | if (SimianGetFirstGenericEntry(groupID, "Group", out GroupName, out GroupInfo)) | 751 | { |
752 | { | 752 | data.GroupID = groupID; |
753 | data.GroupID = groupID; | 753 | data.AllowPublish = GroupInfo["AllowPublish"].AsBoolean(); |
754 | data.AllowPublish = GroupInfo["AllowPublish"].AsBoolean(); | 754 | data.Charter = GroupInfo["Charter"].AsString(); |
755 | data.Charter = GroupInfo["Charter"].AsString(); | 755 | data.FounderID = GroupInfo["FounderID"].AsUUID(); |
756 | data.FounderID = GroupInfo["FounderID"].AsUUID(); | 756 | data.GroupName = GroupName; |
757 | data.GroupName = GroupName; | 757 | data.GroupPicture = GroupInfo["InsigniaID"].AsUUID(); |
758 | data.GroupPicture = GroupInfo["InsigniaID"].AsUUID(); | 758 | data.MaturePublish = GroupInfo["MaturePublish"].AsBoolean(); |
759 | data.MaturePublish = GroupInfo["MaturePublish"].AsBoolean(); | 759 | data.MembershipFee = GroupInfo["MembershipFee"].AsInteger(); |
760 | data.MembershipFee = GroupInfo["MembershipFee"].AsInteger(); | 760 | data.OpenEnrollment = GroupInfo["OpenEnrollment"].AsBoolean(); |
761 | data.OpenEnrollment = GroupInfo["OpenEnrollment"].AsBoolean(); | 761 | data.ShowInList = GroupInfo["ShowInList"].AsBoolean(); |
762 | data.ShowInList = GroupInfo["ShowInList"].AsBoolean(); | 762 | } |
763 | } | 763 | } |
764 | 764 | ||
765 | return data; | 765 | return data; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 59e905e..e6ebc6e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -1917,18 +1917,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1917 | 1917 | ||
1918 | protected void SetTexture(SceneObjectPart part, string texture, int face) | 1918 | protected void SetTexture(SceneObjectPart part, string texture, int face) |
1919 | { | 1919 | { |
1920 | <<<<<<< HEAD:OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | ||
1920 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | 1921 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) |
1921 | return; | 1922 | return; |
1922 | 1923 | ||
1923 | UUID textureID=new UUID(); | 1924 | UUID textureID=new UUID(); |
1925 | ======= | ||
1926 | UUID textureID = new UUID(); | ||
1927 | >>>>>>> master:OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | ||
1924 | 1928 | ||
1925 | if (!UUID.TryParse(texture, out textureID)) | 1929 | textureID = InventoryKey(texture, (int)AssetType.Texture); |
1926 | { | 1930 | if (textureID == UUID.Zero) |
1927 | textureID=InventoryKey(texture, (int)AssetType.Texture); | 1931 | { |
1928 | } | 1932 | if (!UUID.TryParse(texture, out textureID)) |
1929 | 1933 | return; | |
1930 | if (textureID == UUID.Zero) | 1934 | } |
1931 | return; | ||
1932 | 1935 | ||
1933 | Primitive.TextureEntry tex = part.Shape.Textures; | 1936 | Primitive.TextureEntry tex = part.Shape.Textures; |
1934 | 1937 | ||
@@ -3343,15 +3346,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3343 | msg.dialog = (byte)19; // MessageFromObject | 3346 | msg.dialog = (byte)19; // MessageFromObject |
3344 | msg.fromGroup = false;// fromGroup; | 3347 | msg.fromGroup = false;// fromGroup; |
3345 | msg.offline = (byte)0; //offline; | 3348 | msg.offline = (byte)0; //offline; |
3349 | <<<<<<< HEAD:OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | ||
3346 | msg.ParentEstateID = World.RegionInfo.EstateSettings.EstateID; | 3350 | msg.ParentEstateID = World.RegionInfo.EstateSettings.EstateID; |
3347 | msg.Position = new Vector3(m_host.AbsolutePosition); | 3351 | msg.Position = new Vector3(m_host.AbsolutePosition); |
3348 | msg.RegionID = World.RegionInfo.RegionID.Guid; | 3352 | msg.RegionID = World.RegionInfo.RegionID.Guid; |
3349 | msg.binaryBucket = Util.StringToBytes256(m_host.OwnerID.ToString()); | 3353 | msg.binaryBucket = Util.StringToBytes256(m_host.OwnerID.ToString()); |
3354 | ======= | ||
3355 | msg.ParentEstateID = 0; //ParentEstateID; | ||
3356 | msg.Position = new Vector3(m_host.AbsolutePosition); | ||
3357 | msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid; | ||
3358 | msg.binaryBucket | ||
3359 | = Util.StringToBytes256( | ||
3360 | "{0}/{1}/{2}/{3}", | ||
3361 | World.RegionInfo.RegionName, | ||
3362 | (int)Math.Floor(m_host.AbsolutePosition.X), | ||
3363 | (int)Math.Floor(m_host.AbsolutePosition.Y), | ||
3364 | (int)Math.Floor(m_host.AbsolutePosition.Z)); | ||
3365 | >>>>>>> master:OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | ||
3350 | 3366 | ||
3351 | if (m_TransferModule != null) | 3367 | if (m_TransferModule != null) |
3352 | { | 3368 | { |
3353 | m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); | 3369 | m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); |
3354 | } | 3370 | } |
3371 | |||
3355 | ScriptSleep(2000); | 3372 | ScriptSleep(2000); |
3356 | } | 3373 | } |
3357 | 3374 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index cf059b3..4d299d6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -711,7 +711,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
711 | // and convert the regionName to the target region | 711 | // and convert the regionName to the target region |
712 | if (regionName.Contains(".") && regionName.Contains(":")) | 712 | if (regionName.Contains(".") && regionName.Contains(":")) |
713 | { | 713 | { |
714 | // List<GridRegion> regions = World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1); | 714 | World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1); |
715 | // List<GridRegion> regions = World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1); | ||
716 | |||
715 | string[] parts = regionName.Split(new char[] { ':' }); | 717 | string[] parts = regionName.Split(new char[] { ':' }); |
716 | if (parts.Length > 2) | 718 | if (parts.Length > 2) |
717 | regionName = parts[0] + ':' + parts[1] + "/ " + parts[2]; | 719 | regionName = parts[0] + ':' + parts[1] + "/ " + parts[2]; |
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index b33b0d5..a6dc287 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | |||
@@ -110,11 +110,14 @@ namespace OpenSim.Server.Handlers.Simulation | |||
110 | DoAgentDelete(request, responsedata, agentID, action, regionID); | 110 | DoAgentDelete(request, responsedata, agentID, action, regionID); |
111 | return responsedata; | 111 | return responsedata; |
112 | } | 112 | } |
113 | <<<<<<< HEAD:OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | ||
113 | else if (method.Equals("DELETECHILD")) | 114 | else if (method.Equals("DELETECHILD")) |
114 | { | 115 | { |
115 | DoChildAgentDelete(request, responsedata, agentID, action, regionID); | 116 | DoChildAgentDelete(request, responsedata, agentID, action, regionID); |
116 | return responsedata; | 117 | return responsedata; |
117 | } | 118 | } |
119 | ======= | ||
120 | >>>>>>> master:OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | ||
118 | else if (method.Equals("QUERYACCESS")) | 121 | else if (method.Equals("QUERYACCESS")) |
119 | { | 122 | { |
120 | DoQueryAccess(request, responsedata, agentID, regionID); | 123 | DoQueryAccess(request, responsedata, agentID, regionID); |
diff --git a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs deleted file mode 100644 index 9878855..0000000 --- a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs +++ /dev/null | |||
@@ -1,335 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using log4net; | ||
29 | using Nini.Config; | ||
30 | using System; | ||
31 | using System.Collections.Generic; | ||
32 | using System.Reflection; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Services.Interfaces; | ||
35 | using OpenMetaverse; | ||
36 | |||
37 | namespace OpenSim.Services.Connectors.Inventory | ||
38 | { | ||
39 | public class HGInventoryServiceConnector : ISessionAuthInventoryService | ||
40 | { | ||
41 | private static readonly ILog m_log = | ||
42 | LogManager.GetLogger( | ||
43 | MethodBase.GetCurrentMethod().DeclaringType); | ||
44 | |||
45 | private Dictionary<string, InventoryServicesConnector> m_connectors = new Dictionary<string, InventoryServicesConnector>(); | ||
46 | |||
47 | public HGInventoryServiceConnector(IConfigSource source) | ||
48 | { | ||
49 | IConfig moduleConfig = source.Configs["Modules"]; | ||
50 | if (moduleConfig != null) | ||
51 | { | ||
52 | |||
53 | IConfig inventoryConfig = source.Configs["InventoryService"]; | ||
54 | if (inventoryConfig == null) | ||
55 | { | ||
56 | m_log.Error("[HG INVENTORY SERVICE]: InventoryService missing from OpenSim.ini"); | ||
57 | return; | ||
58 | } | ||
59 | |||
60 | m_log.Info("[HG INVENTORY SERVICE]: HG inventory service enabled"); | ||
61 | } | ||
62 | } | ||
63 | |||
64 | private bool StringToUrlAndUserID(string id, out string url, out string userID) | ||
65 | { | ||
66 | url = String.Empty; | ||
67 | userID = String.Empty; | ||
68 | |||
69 | Uri assetUri; | ||
70 | |||
71 | if (Uri.TryCreate(id, UriKind.Absolute, out assetUri) && | ||
72 | assetUri.Scheme == Uri.UriSchemeHttp) | ||
73 | { | ||
74 | url = "http://" + assetUri.Authority; | ||
75 | userID = assetUri.LocalPath.Trim(new char[] { '/' }); | ||
76 | return true; | ||
77 | } | ||
78 | |||
79 | return false; | ||
80 | } | ||
81 | private ISessionAuthInventoryService GetConnector(string url) | ||
82 | { | ||
83 | InventoryServicesConnector connector = null; | ||
84 | lock (m_connectors) | ||
85 | { | ||
86 | if (m_connectors.ContainsKey(url)) | ||
87 | { | ||
88 | connector = m_connectors[url]; | ||
89 | } | ||
90 | else | ||
91 | { | ||
92 | // We're instantiating this class explicitly, but this won't | ||
93 | // work in general, because the remote grid may be running | ||
94 | // an inventory server that has a different protocol. | ||
95 | // Eventually we will want a piece of protocol asking | ||
96 | // the remote server about its kind. Definitely cool thing to do! | ||
97 | connector = new InventoryServicesConnector(url); | ||
98 | m_connectors.Add(url, connector); | ||
99 | } | ||
100 | } | ||
101 | return connector; | ||
102 | } | ||
103 | |||
104 | public string Host | ||
105 | { | ||
106 | get { return string.Empty; } | ||
107 | } | ||
108 | |||
109 | public void GetUserInventory(string id, UUID sessionID, InventoryReceiptCallback callback) | ||
110 | { | ||
111 | m_log.Debug("[HGInventory]: GetUserInventory " + id); | ||
112 | string url = string.Empty; | ||
113 | string userID = string.Empty; | ||
114 | |||
115 | if (StringToUrlAndUserID(id, out url, out userID)) | ||
116 | { | ||
117 | ISessionAuthInventoryService connector = GetConnector(url); | ||
118 | connector.GetUserInventory(userID, sessionID, callback); | ||
119 | } | ||
120 | |||
121 | } | ||
122 | |||
123 | /// <summary> | ||
124 | /// Gets the user folder for the given folder-type | ||
125 | /// </summary> | ||
126 | /// <param name="userID"></param> | ||
127 | /// <param name="type"></param> | ||
128 | /// <returns></returns> | ||
129 | public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(string id, UUID sessionID) | ||
130 | { | ||
131 | m_log.Debug("[HGInventory]: GetSystemFolders " + id); | ||
132 | string url = string.Empty; | ||
133 | string userID = string.Empty; | ||
134 | |||
135 | if (StringToUrlAndUserID(id, out url, out userID)) | ||
136 | { | ||
137 | ISessionAuthInventoryService connector = GetConnector(url); | ||
138 | return connector.GetSystemFolders(userID, sessionID); | ||
139 | } | ||
140 | |||
141 | return new Dictionary<AssetType, InventoryFolderBase>(); | ||
142 | } | ||
143 | |||
144 | /// <summary> | ||
145 | /// Gets everything (folders and items) inside a folder | ||
146 | /// </summary> | ||
147 | /// <param name="userId"></param> | ||
148 | /// <param name="folderID"></param> | ||
149 | /// <returns></returns> | ||
150 | public InventoryCollection GetFolderContent(string id, UUID folderID, UUID sessionID) | ||
151 | { | ||
152 | m_log.Debug("[HGInventory]: GetFolderContent " + id); | ||
153 | string url = string.Empty; | ||
154 | string userID = string.Empty; | ||
155 | |||
156 | if (StringToUrlAndUserID(id, out url, out userID)) | ||
157 | { | ||
158 | ISessionAuthInventoryService connector = GetConnector(url); | ||
159 | return connector.GetFolderContent(userID, folderID, sessionID); | ||
160 | } | ||
161 | |||
162 | return null; | ||
163 | } | ||
164 | |||
165 | public bool AddFolder(string id, InventoryFolderBase folder, UUID sessionID) | ||
166 | { | ||
167 | string url = string.Empty; | ||
168 | string userID = string.Empty; | ||
169 | |||
170 | if (StringToUrlAndUserID(id, out url, out userID)) | ||
171 | { | ||
172 | ISessionAuthInventoryService connector = GetConnector(url); | ||
173 | return connector.AddFolder(userID, folder, sessionID); | ||
174 | } | ||
175 | return false; | ||
176 | } | ||
177 | |||
178 | public bool UpdateFolder(string id, InventoryFolderBase folder, UUID sessionID) | ||
179 | { | ||
180 | string url = string.Empty; | ||
181 | string userID = string.Empty; | ||
182 | |||
183 | if (StringToUrlAndUserID(id, out url, out userID)) | ||
184 | { | ||
185 | ISessionAuthInventoryService connector = GetConnector(url); | ||
186 | return connector.UpdateFolder(userID, folder, sessionID); | ||
187 | } | ||
188 | return false; | ||
189 | } | ||
190 | |||
191 | public bool MoveFolder(string id, InventoryFolderBase folder, UUID sessionID) | ||
192 | { | ||
193 | string url = string.Empty; | ||
194 | string userID = string.Empty; | ||
195 | |||
196 | if (StringToUrlAndUserID(id, out url, out userID)) | ||
197 | { | ||
198 | ISessionAuthInventoryService connector = GetConnector(url); | ||
199 | return connector.MoveFolder(userID, folder, sessionID); | ||
200 | } | ||
201 | return false; | ||
202 | } | ||
203 | |||
204 | public bool DeleteFolders(string id, List<UUID> folders, UUID sessionID) | ||
205 | { | ||
206 | string url = string.Empty; | ||
207 | string userID = string.Empty; | ||
208 | |||
209 | if (StringToUrlAndUserID(id, out url, out userID)) | ||
210 | { | ||
211 | ISessionAuthInventoryService connector = GetConnector(url); | ||
212 | return connector.DeleteFolders(userID, folders, sessionID); | ||
213 | } | ||
214 | return false; | ||
215 | } | ||
216 | |||
217 | public bool PurgeFolder(string id, InventoryFolderBase folder, UUID sessionID) | ||
218 | { | ||
219 | string url = string.Empty; | ||
220 | string userID = string.Empty; | ||
221 | |||
222 | if (StringToUrlAndUserID(id, out url, out userID)) | ||
223 | { | ||
224 | ISessionAuthInventoryService connector = GetConnector(url); | ||
225 | return connector.PurgeFolder(userID, folder, sessionID); | ||
226 | } | ||
227 | return false; | ||
228 | } | ||
229 | |||
230 | public List<InventoryItemBase> GetFolderItems(string id, UUID folderID, UUID sessionID) | ||
231 | { | ||
232 | string url = string.Empty; | ||
233 | string userID = string.Empty; | ||
234 | |||
235 | if (StringToUrlAndUserID(id, out url, out userID)) | ||
236 | { | ||
237 | ISessionAuthInventoryService connector = GetConnector(url); | ||
238 | return connector.GetFolderItems(userID, folderID, sessionID); | ||
239 | } | ||
240 | return new List<InventoryItemBase>(); | ||
241 | } | ||
242 | |||
243 | public bool AddItem(string id, InventoryItemBase item, UUID sessionID) | ||
244 | { | ||
245 | string url = string.Empty; | ||
246 | string userID = string.Empty; | ||
247 | |||
248 | if (StringToUrlAndUserID(id, out url, out userID)) | ||
249 | { | ||
250 | ISessionAuthInventoryService connector = GetConnector(url); | ||
251 | return connector.AddItem(userID, item, sessionID); | ||
252 | } | ||
253 | return false; | ||
254 | } | ||
255 | |||
256 | public bool UpdateItem(string id, InventoryItemBase item, UUID sessionID) | ||
257 | { | ||
258 | string url = string.Empty; | ||
259 | string userID = string.Empty; | ||
260 | |||
261 | if (StringToUrlAndUserID(id, out url, out userID)) | ||
262 | { | ||
263 | ISessionAuthInventoryService connector = GetConnector(url); | ||
264 | return connector.UpdateItem(userID, item, sessionID); | ||
265 | } | ||
266 | return false; | ||
267 | } | ||
268 | |||
269 | public bool MoveItems(string id, List<InventoryItemBase> items, UUID sessionID) | ||
270 | { | ||
271 | string url = string.Empty; | ||
272 | string userID = string.Empty; | ||
273 | |||
274 | if (StringToUrlAndUserID(id, out url, out userID)) | ||
275 | { | ||
276 | ISessionAuthInventoryService connector = GetConnector(url); | ||
277 | return connector.MoveItems(userID, items, sessionID); | ||
278 | } | ||
279 | return false; | ||
280 | } | ||
281 | |||
282 | public bool DeleteItems(string id, List<UUID> itemIDs, UUID sessionID) | ||
283 | { | ||
284 | string url = string.Empty; | ||
285 | string userID = string.Empty; | ||
286 | |||
287 | if (StringToUrlAndUserID(id, out url, out userID)) | ||
288 | { | ||
289 | ISessionAuthInventoryService connector = GetConnector(url); | ||
290 | return connector.DeleteItems(userID, itemIDs, sessionID); | ||
291 | } | ||
292 | return false; | ||
293 | } | ||
294 | |||
295 | public InventoryItemBase QueryItem(string id, InventoryItemBase item, UUID sessionID) | ||
296 | { | ||
297 | string url = string.Empty; | ||
298 | string userID = string.Empty; | ||
299 | |||
300 | if (StringToUrlAndUserID(id, out url, out userID)) | ||
301 | { | ||
302 | //m_log.DebugFormat("[HGInventory CONNECTOR]: calling {0}", url); | ||
303 | ISessionAuthInventoryService connector = GetConnector(url); | ||
304 | return connector.QueryItem(userID, item, sessionID); | ||
305 | } | ||
306 | return null; | ||
307 | } | ||
308 | |||
309 | public InventoryFolderBase QueryFolder(string id, InventoryFolderBase folder, UUID sessionID) | ||
310 | { | ||
311 | string url = string.Empty; | ||
312 | string userID = string.Empty; | ||
313 | |||
314 | if (StringToUrlAndUserID(id, out url, out userID)) | ||
315 | { | ||
316 | ISessionAuthInventoryService connector = GetConnector(url); | ||
317 | return connector.QueryFolder(userID, folder, sessionID); | ||
318 | } | ||
319 | return null; | ||
320 | } | ||
321 | |||
322 | public int GetAssetPermissions(string id, UUID assetID, UUID sessionID) | ||
323 | { | ||
324 | string url = string.Empty; | ||
325 | string userID = string.Empty; | ||
326 | |||
327 | if (StringToUrlAndUserID(id, out url, out userID)) | ||
328 | { | ||
329 | ISessionAuthInventoryService connector = GetConnector(url); | ||
330 | return connector.GetAssetPermissions(userID, assetID, sessionID); | ||
331 | } | ||
332 | return 0; | ||
333 | } | ||
334 | } | ||
335 | } | ||
diff --git a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs deleted file mode 100644 index da8c7e2..0000000 --- a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs +++ /dev/null | |||
@@ -1,140 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Collections.Generic; | ||
29 | using OpenSim.Framework; | ||
30 | using OpenSim.Services.Interfaces; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Services.Connectors | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// Defines all operations to access a remote inventory service | ||
37 | /// using session authentication as a form of security. | ||
38 | /// </summary> | ||
39 | public interface ISessionAuthInventoryService | ||
40 | { | ||
41 | string Host | ||
42 | { | ||
43 | get; | ||
44 | } | ||
45 | |||
46 | /// <summary> | ||
47 | /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the | ||
48 | /// inventory has been received | ||
49 | /// </summary> | ||
50 | /// <param name="userID"></param> | ||
51 | /// <param name="callback"></param> | ||
52 | void GetUserInventory(string userID, UUID session_id, InventoryReceiptCallback callback); | ||
53 | |||
54 | /// <summary> | ||
55 | /// Gets the user folder for the given folder-type | ||
56 | /// </summary> | ||
57 | /// <param name="userID"></param> | ||
58 | /// <param name="type"></param> | ||
59 | /// <returns></returns> | ||
60 | Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(string userID, UUID session_id); | ||
61 | |||
62 | /// <summary> | ||
63 | /// Gets everything (folders and items) inside a folder | ||
64 | /// </summary> | ||
65 | /// <param name="userId"></param> | ||
66 | /// <param name="folderID"></param> | ||
67 | /// <returns></returns> | ||
68 | InventoryCollection GetFolderContent(string userID, UUID folderID, UUID session_id); | ||
69 | |||
70 | /// <summary> | ||
71 | /// Add a new folder to the user's inventory | ||
72 | /// </summary> | ||
73 | /// <param name="folder"></param> | ||
74 | /// <returns>true if the folder was successfully added</returns> | ||
75 | bool AddFolder(string userID, InventoryFolderBase folder, UUID session_id); | ||
76 | |||
77 | /// <summary> | ||
78 | /// Update a folder in the user's inventory | ||
79 | /// </summary> | ||
80 | /// <param name="folder"></param> | ||
81 | /// <returns>true if the folder was successfully updated</returns> | ||
82 | bool UpdateFolder(string userID, InventoryFolderBase folder, UUID session_id); | ||
83 | |||
84 | /// <summary> | ||
85 | /// Move an inventory folder to a new location | ||
86 | /// </summary> | ||
87 | /// <param name="folder">A folder containing the details of the new location</param> | ||
88 | /// <returns>true if the folder was successfully moved</returns> | ||
89 | bool MoveFolder(string userID, InventoryFolderBase folder, UUID session_id); | ||
90 | |||
91 | /// <summary> | ||
92 | /// Delete a list of inventory folders (from trash) | ||
93 | /// </summary> | ||
94 | bool DeleteFolders(string userID, List<UUID> folders, UUID session_id); | ||
95 | |||
96 | /// <summary> | ||
97 | /// Purge an inventory folder of all its items and subfolders. | ||
98 | /// </summary> | ||
99 | /// <param name="folder"></param> | ||
100 | /// <returns>true if the folder was successfully purged</returns> | ||
101 | bool PurgeFolder(string userID, InventoryFolderBase folder, UUID session_id); | ||
102 | |||
103 | /// <summary> | ||
104 | /// Get items from a folder. | ||
105 | /// </summary> | ||
106 | /// <param name="folder"></param> | ||
107 | /// <returns>true if the folder was successfully purged</returns> | ||
108 | List<InventoryItemBase> GetFolderItems(string userID, UUID folderID, UUID session_id); | ||
109 | |||
110 | /// <summary> | ||
111 | /// Add a new item to the user's inventory | ||
112 | /// </summary> | ||
113 | /// <param name="item"></param> | ||
114 | /// <returns>true if the item was successfully added</returns> | ||
115 | bool AddItem(string userID, InventoryItemBase item, UUID session_id); | ||
116 | |||
117 | /// <summary> | ||
118 | /// Update an item in the user's inventory | ||
119 | /// </summary> | ||
120 | /// <param name="item"></param> | ||
121 | /// <returns>true if the item was successfully updated</returns> | ||
122 | bool UpdateItem(string userID, InventoryItemBase item, UUID session_id); | ||
123 | |||
124 | bool MoveItems(string userID, List<InventoryItemBase> items, UUID session_id); | ||
125 | |||
126 | /// <summary> | ||
127 | /// Delete an item from the user's inventory | ||
128 | /// </summary> | ||
129 | /// <param name="item"></param> | ||
130 | /// <returns>true if the item was successfully deleted</returns> | ||
131 | bool DeleteItems(string userID, List<UUID> itemIDs, UUID session_id); | ||
132 | |||
133 | InventoryItemBase QueryItem(string userID, InventoryItemBase item, UUID session_id); | ||
134 | |||
135 | InventoryFolderBase QueryFolder(string userID, InventoryFolderBase item, UUID session_id); | ||
136 | |||
137 | int GetAssetPermissions(string userID, UUID assetID, UUID session_id); | ||
138 | |||
139 | } | ||
140 | } | ||
diff --git a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs deleted file mode 100644 index f86b453..0000000 --- a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs +++ /dev/null | |||
@@ -1,582 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using log4net; | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.IO; | ||
32 | using System.Reflection; | ||
33 | using Nini.Config; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Framework.Servers.HttpServer; | ||
36 | using OpenSim.Services.Interfaces; | ||
37 | using OpenMetaverse; | ||
38 | |||
39 | namespace OpenSim.Services.Connectors | ||
40 | { | ||
41 | public class InventoryServicesConnector : ISessionAuthInventoryService | ||
42 | { | ||
43 | private static readonly ILog m_log = | ||
44 | LogManager.GetLogger( | ||
45 | MethodBase.GetCurrentMethod().DeclaringType); | ||
46 | |||
47 | private string m_ServerURI = String.Empty; | ||
48 | |||
49 | private Dictionary<UUID, InventoryReceiptCallback> m_RequestingInventory = new Dictionary<UUID, InventoryReceiptCallback>(); | ||
50 | private Dictionary<UUID, DateTime> m_RequestTime = new Dictionary<UUID, DateTime>(); | ||
51 | |||
52 | public InventoryServicesConnector() | ||
53 | { | ||
54 | } | ||
55 | |||
56 | public InventoryServicesConnector(string serverURI) | ||
57 | { | ||
58 | m_ServerURI = serverURI.TrimEnd('/'); | ||
59 | } | ||
60 | |||
61 | public InventoryServicesConnector(IConfigSource source) | ||
62 | { | ||
63 | Initialise(source); | ||
64 | } | ||
65 | |||
66 | public virtual void Initialise(IConfigSource source) | ||
67 | { | ||
68 | IConfig inventoryConfig = source.Configs["InventoryService"]; | ||
69 | if (inventoryConfig == null) | ||
70 | { | ||
71 | m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); | ||
72 | throw new Exception("InventoryService missing from OpenSim.ini"); | ||
73 | } | ||
74 | |||
75 | string serviceURI = inventoryConfig.GetString("InventoryServerURI", | ||
76 | String.Empty); | ||
77 | |||
78 | if (serviceURI == String.Empty) | ||
79 | { | ||
80 | m_log.Error("[INVENTORY CONNECTOR]: No Server URI named in section InventoryService"); | ||
81 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); | ||
82 | } | ||
83 | m_ServerURI = serviceURI.TrimEnd('/'); | ||
84 | } | ||
85 | |||
86 | #region ISessionAuthInventoryService | ||
87 | |||
88 | public string Host | ||
89 | { | ||
90 | get { return m_ServerURI; } | ||
91 | } | ||
92 | |||
93 | /// <summary> | ||
94 | /// Caller must catch eventual Exceptions. | ||
95 | /// </summary> | ||
96 | /// <param name="userID"></param> | ||
97 | /// <param name="sessionID"></param> | ||
98 | /// <param name="callback"></param> | ||
99 | public void GetUserInventory(string userIDStr, UUID sessionID, InventoryReceiptCallback callback) | ||
100 | { | ||
101 | UUID userID = UUID.Zero; | ||
102 | if (UUID.TryParse(userIDStr, out userID)) | ||
103 | { | ||
104 | lock (m_RequestingInventory) | ||
105 | { | ||
106 | // *HACK ALERT* | ||
107 | |||
108 | // If an inventory request times out, it blocks any further requests from the | ||
109 | // same user, even after a relog. This is bad, and makes me sad. | ||
110 | |||
111 | // Really, we should detect a timeout and report a failure to the callback, | ||
112 | // BUT in my testing i found that it's hard to detect a timeout.. sometimes, | ||
113 | // a partial response is recieved, and sometimes a null response. | ||
114 | |||
115 | // So, for now, add a timer of ten seconds (which is the request timeout). | ||
116 | |||
117 | // This should basically have the same effect. | ||
118 | |||
119 | lock (m_RequestTime) | ||
120 | { | ||
121 | if (m_RequestTime.ContainsKey(userID)) | ||
122 | { | ||
123 | TimeSpan interval = DateTime.Now - m_RequestTime[userID]; | ||
124 | if (interval.TotalSeconds > 10) | ||
125 | { | ||
126 | m_RequestTime.Remove(userID); | ||
127 | if (m_RequestingInventory.ContainsKey(userID)) | ||
128 | { | ||
129 | m_RequestingInventory.Remove(userID); | ||
130 | } | ||
131 | } | ||
132 | } | ||
133 | if (!m_RequestingInventory.ContainsKey(userID)) | ||
134 | { | ||
135 | m_RequestTime.Add(userID, DateTime.Now); | ||
136 | m_RequestingInventory.Add(userID, callback); | ||
137 | } | ||
138 | else | ||
139 | { | ||
140 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetUserInventory - ignoring repeated request for user {0}", userID); | ||
141 | return; | ||
142 | } | ||
143 | } | ||
144 | } | ||
145 | |||
146 | m_log.InfoFormat( | ||
147 | "[INVENTORY CONNECTOR]: Requesting inventory from {0}/GetInventory/ for user {1}", | ||
148 | m_ServerURI, userID); | ||
149 | |||
150 | RestSessionObjectPosterResponse<Guid, InventoryCollection> requester | ||
151 | = new RestSessionObjectPosterResponse<Guid, InventoryCollection>(); | ||
152 | requester.ResponseCallback = InventoryResponse; | ||
153 | |||
154 | requester.BeginPostObject(m_ServerURI + "/GetInventory/", userID.Guid, sessionID.ToString(), userID.ToString()); | ||
155 | } | ||
156 | } | ||
157 | |||
158 | /// <summary> | ||
159 | /// Gets the user folder for the given folder-type | ||
160 | /// </summary> | ||
161 | /// <param name="userID"></param> | ||
162 | /// <param name="type"></param> | ||
163 | /// <returns></returns> | ||
164 | public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(string userID, UUID sessionID) | ||
165 | { | ||
166 | List<InventoryFolderBase> folders = null; | ||
167 | Dictionary<AssetType, InventoryFolderBase> dFolders = new Dictionary<AssetType, InventoryFolderBase>(); | ||
168 | try | ||
169 | { | ||
170 | folders = SynchronousRestSessionObjectPoster<Guid, List<InventoryFolderBase>>.BeginPostObject( | ||
171 | "POST", m_ServerURI + "/SystemFolders/", new Guid(userID), sessionID.ToString(), userID.ToString()); | ||
172 | |||
173 | foreach (InventoryFolderBase f in folders) | ||
174 | dFolders[(AssetType)f.Type] = f; | ||
175 | |||
176 | return dFolders; | ||
177 | } | ||
178 | catch (Exception e) | ||
179 | { | ||
180 | // Maybe we're talking to an old inventory server. Try this other thing. | ||
181 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetSystemFolders operation failed, {0} {1} (old sever?). Trying GetInventory.", | ||
182 | e.Source, e.Message); | ||
183 | |||
184 | try | ||
185 | { | ||
186 | InventoryCollection inventory = SynchronousRestSessionObjectPoster<Guid, InventoryCollection>.BeginPostObject( | ||
187 | "POST", m_ServerURI + "/GetInventory/", new Guid(userID), sessionID.ToString(), userID.ToString()); | ||
188 | folders = inventory.Folders; | ||
189 | } | ||
190 | catch (Exception ex) | ||
191 | { | ||
192 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetInventory operation also failed, {0} {1}. Giving up.", | ||
193 | e.Source, ex.Message); | ||
194 | } | ||
195 | |||
196 | if ((folders != null) && (folders.Count > 0)) | ||
197 | { | ||
198 | m_log.DebugFormat("[INVENTORY CONNECTOR]: Received entire inventory ({0} folders) for user {1}", | ||
199 | folders.Count, userID); | ||
200 | foreach (InventoryFolderBase f in folders) | ||
201 | { | ||
202 | if ((f.Type != (short)AssetType.Folder) && (f.Type != (short)AssetType.Unknown)) | ||
203 | dFolders[(AssetType)f.Type] = f; | ||
204 | } | ||
205 | |||
206 | UUID rootFolderID = dFolders[AssetType.Animation].ParentID; | ||
207 | InventoryFolderBase rootFolder = new InventoryFolderBase(rootFolderID, new UUID(userID)); | ||
208 | rootFolder = QueryFolder(userID, rootFolder, sessionID); | ||
209 | dFolders[AssetType.Folder] = rootFolder; | ||
210 | m_log.DebugFormat("[INVENTORY CONNECTOR]: {0} system folders for user {1}", dFolders.Count, userID); | ||
211 | return dFolders; | ||
212 | } | ||
213 | } | ||
214 | |||
215 | return new Dictionary<AssetType, InventoryFolderBase>(); | ||
216 | } | ||
217 | |||
218 | /// <summary> | ||
219 | /// Gets everything (folders and items) inside a folder | ||
220 | /// </summary> | ||
221 | /// <param name="userId"></param> | ||
222 | /// <param name="folderID"></param> | ||
223 | /// <returns></returns> | ||
224 | public InventoryCollection GetFolderContent(string userID, UUID folderID, UUID sessionID) | ||
225 | { | ||
226 | try | ||
227 | { | ||
228 | // normal case | ||
229 | return SynchronousRestSessionObjectPoster<Guid, InventoryCollection>.BeginPostObject( | ||
230 | "POST", m_ServerURI + "/GetFolderContent/", folderID.Guid, sessionID.ToString(), userID.ToString()); | ||
231 | } | ||
232 | catch (TimeoutException e) | ||
233 | { | ||
234 | m_log.ErrorFormat( | ||
235 | "[INVENTORY CONNECTOR]: GetFolderContent operation to {0} for {1} timed out {2} {3}.", | ||
236 | m_ServerURI, folderID, e.Source, e.Message); | ||
237 | } | ||
238 | catch (Exception e) | ||
239 | { | ||
240 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderContent operation failed for {0}, {1} {2} (old server?).", | ||
241 | folderID, e.Source, e.Message); | ||
242 | } | ||
243 | |||
244 | InventoryCollection nullCollection = new InventoryCollection(); | ||
245 | nullCollection.Folders = new List<InventoryFolderBase>(); | ||
246 | nullCollection.Items = new List<InventoryItemBase>(); | ||
247 | nullCollection.UserID = new UUID(userID); | ||
248 | return nullCollection; | ||
249 | } | ||
250 | |||
251 | public bool AddFolder(string userID, InventoryFolderBase folder, UUID sessionID) | ||
252 | { | ||
253 | try | ||
254 | { | ||
255 | return SynchronousRestSessionObjectPoster<InventoryFolderBase, bool>.BeginPostObject( | ||
256 | "POST", m_ServerURI + "/NewFolder/", folder, sessionID.ToString(), folder.Owner.ToString()); | ||
257 | } | ||
258 | catch (Exception e) | ||
259 | { | ||
260 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: Add new inventory folder operation failed for {0} {1}, {2} {3}", | ||
261 | folder.Name, folder.ID, e.Source, e.Message); | ||
262 | } | ||
263 | |||
264 | return false; | ||
265 | } | ||
266 | |||
267 | public bool UpdateFolder(string userID, InventoryFolderBase folder, UUID sessionID) | ||
268 | { | ||
269 | try | ||
270 | { | ||
271 | return SynchronousRestSessionObjectPoster<InventoryFolderBase, bool>.BeginPostObject( | ||
272 | "POST", m_ServerURI + "/UpdateFolder/", folder, sessionID.ToString(), folder.Owner.ToString()); | ||
273 | } | ||
274 | catch (Exception e) | ||
275 | { | ||
276 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: Update inventory folder operation failed for {0} {1}, {2} {3}", | ||
277 | folder.Name, folder.ID, e.Source, e.Message); | ||
278 | } | ||
279 | |||
280 | return false; | ||
281 | } | ||
282 | |||
283 | public bool DeleteFolders(string userID, List<UUID> folderIDs, UUID sessionID) | ||
284 | { | ||
285 | try | ||
286 | { | ||
287 | List<Guid> guids = new List<Guid>(); | ||
288 | foreach (UUID u in folderIDs) | ||
289 | guids.Add(u.Guid); | ||
290 | return SynchronousRestSessionObjectPoster<List<Guid>, bool>.BeginPostObject( | ||
291 | "POST", m_ServerURI + "/DeleteFolders/", guids, sessionID.ToString(), userID); | ||
292 | } | ||
293 | catch (Exception e) | ||
294 | { | ||
295 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: Delete inventory folders operation failed, {0} {1}", | ||
296 | e.Source, e.Message); | ||
297 | } | ||
298 | |||
299 | return false; | ||
300 | } | ||
301 | |||
302 | public bool MoveFolder(string userID, InventoryFolderBase folder, UUID sessionID) | ||
303 | { | ||
304 | try | ||
305 | { | ||
306 | return SynchronousRestSessionObjectPoster<InventoryFolderBase, bool>.BeginPostObject( | ||
307 | "POST", m_ServerURI + "/MoveFolder/", folder, sessionID.ToString(), folder.Owner.ToString()); | ||
308 | } | ||
309 | catch (Exception e) | ||
310 | { | ||
311 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: Move inventory folder operation failed for {0} {1}, {2} {3}", | ||
312 | folder.Name, folder.ID, e.Source, e.Message); | ||
313 | } | ||
314 | |||
315 | return false; | ||
316 | } | ||
317 | |||
318 | public bool PurgeFolder(string userID, InventoryFolderBase folder, UUID sessionID) | ||
319 | { | ||
320 | try | ||
321 | { | ||
322 | return SynchronousRestSessionObjectPoster<InventoryFolderBase, bool>.BeginPostObject( | ||
323 | "POST", m_ServerURI + "/PurgeFolder/", folder, sessionID.ToString(), folder.Owner.ToString()); | ||
324 | } | ||
325 | catch (Exception e) | ||
326 | { | ||
327 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: Purge inventory folder operation failed for {0} {1}, {2} {3}", | ||
328 | folder.Name, folder.ID, e.Source, e.Message); | ||
329 | } | ||
330 | |||
331 | return false; | ||
332 | } | ||
333 | |||
334 | public List<InventoryItemBase> GetFolderItems(string userID, UUID folderID, UUID sessionID) | ||
335 | { | ||
336 | try | ||
337 | { | ||
338 | InventoryFolderBase folder = new InventoryFolderBase(folderID, new UUID(userID)); | ||
339 | return SynchronousRestSessionObjectPoster<InventoryFolderBase, List<InventoryItemBase>>.BeginPostObject( | ||
340 | "POST", m_ServerURI + "/GetItems/", folder, sessionID.ToString(), userID); | ||
341 | } | ||
342 | catch (Exception e) | ||
343 | { | ||
344 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: Get folder items operation failed for folder {0}, {1} {2}", | ||
345 | folderID, e.Source, e.Message); | ||
346 | } | ||
347 | |||
348 | return null; | ||
349 | } | ||
350 | |||
351 | public bool AddItem(string userID, InventoryItemBase item, UUID sessionID) | ||
352 | { | ||
353 | try | ||
354 | { | ||
355 | return SynchronousRestSessionObjectPoster<InventoryItemBase, bool>.BeginPostObject( | ||
356 | "POST", m_ServerURI + "/NewItem/", item, sessionID.ToString(), item.Owner.ToString()); | ||
357 | } | ||
358 | catch (Exception e) | ||
359 | { | ||
360 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: Add new inventory item operation failed for {0} {1}, {2} {3}", | ||
361 | item.Name, item.ID, e.Source, e.Message); | ||
362 | } | ||
363 | |||
364 | return false; | ||
365 | } | ||
366 | |||
367 | public bool UpdateItem(string userID, InventoryItemBase item, UUID sessionID) | ||
368 | { | ||
369 | try | ||
370 | { | ||
371 | return SynchronousRestSessionObjectPoster<InventoryItemBase, bool>.BeginPostObject( | ||
372 | "POST", m_ServerURI + "/NewItem/", item, sessionID.ToString(), item.Owner.ToString()); | ||
373 | } | ||
374 | catch (Exception e) | ||
375 | { | ||
376 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: Update new inventory item operation failed for {0} {1}, {2} {3}", | ||
377 | item.Name, item.ID, e.Source, e.Message); | ||
378 | } | ||
379 | |||
380 | return false; | ||
381 | } | ||
382 | |||
383 | /** | ||
384 | * MoveItems Async group | ||
385 | */ | ||
386 | |||
387 | delegate void MoveItemsDelegate(string userID, List<InventoryItemBase> items, UUID sessionID); | ||
388 | |||
389 | private void MoveItemsAsync(string userID, List<InventoryItemBase> items, UUID sessionID) | ||
390 | { | ||
391 | if (items == null) | ||
392 | { | ||
393 | m_log.WarnFormat("[INVENTORY CONNECTOR]: request to move items got a null list."); | ||
394 | return; | ||
395 | } | ||
396 | |||
397 | try | ||
398 | { | ||
399 | //SynchronousRestSessionObjectPoster<List<InventoryItemBase>, bool>.BeginPostObject( | ||
400 | // "POST", m_ServerURI + "/MoveItems/", items, sessionID.ToString(), userID.ToString()); | ||
401 | |||
402 | //// Success | ||
403 | //return; | ||
404 | string uri = m_ServerURI + "/inventory/" + userID; | ||
405 | if (SynchronousRestObjectRequester. | ||
406 | MakeRequest<List<InventoryItemBase>, bool>("PUT", uri, items)) | ||
407 | m_log.DebugFormat("[INVENTORY CONNECTOR]: move {0} items poster succeeded {1}", items.Count, uri); | ||
408 | else | ||
409 | m_log.DebugFormat("[INVENTORY CONNECTOR]: move {0} items poster failed {1}", items.Count, uri); ; | ||
410 | |||
411 | return; | ||
412 | |||
413 | } | ||
414 | catch (Exception e) | ||
415 | { | ||
416 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: Move inventory items operation failed, {0} {1} (old server?). Trying slow way.", | ||
417 | e.Source, e.Message); | ||
418 | } | ||
419 | |||
420 | } | ||
421 | |||
422 | private void MoveItemsCompleted(IAsyncResult iar) | ||
423 | { | ||
424 | MoveItemsDelegate d = (MoveItemsDelegate)iar.AsyncState; | ||
425 | d.EndInvoke(iar); | ||
426 | } | ||
427 | |||
428 | public bool MoveItems(string userID, List<InventoryItemBase> items, UUID sessionID) | ||
429 | { | ||
430 | MoveItemsDelegate d = MoveItemsAsync; | ||
431 | d.BeginInvoke(userID, items, sessionID, MoveItemsCompleted, d); | ||
432 | return true; | ||
433 | } | ||
434 | |||
435 | public bool DeleteItems(string userID, List<UUID> items, UUID sessionID) | ||
436 | { | ||
437 | try | ||
438 | { | ||
439 | List<Guid> guids = new List<Guid>(); | ||
440 | foreach (UUID u in items) | ||
441 | guids.Add(u.Guid); | ||
442 | return SynchronousRestSessionObjectPoster<List<Guid>, bool>.BeginPostObject( | ||
443 | "POST", m_ServerURI + "/DeleteItem/", guids, sessionID.ToString(), userID); | ||
444 | } | ||
445 | catch (Exception e) | ||
446 | { | ||
447 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: Delete inventory items operation failed, {0} {1}", | ||
448 | e.Source, e.Message); | ||
449 | } | ||
450 | |||
451 | return false; | ||
452 | } | ||
453 | |||
454 | public InventoryItemBase QueryItem(string userID, InventoryItemBase item, UUID sessionID) | ||
455 | { | ||
456 | try | ||
457 | { | ||
458 | return SynchronousRestSessionObjectPoster<InventoryItemBase, InventoryItemBase>.BeginPostObject( | ||
459 | "POST", m_ServerURI + "/QueryItem/", item, sessionID.ToString(), item.Owner.ToString()); | ||
460 | } | ||
461 | catch (Exception e) | ||
462 | { | ||
463 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: Query inventory item operation failed, {0} {1}", | ||
464 | e.Source, e.Message); | ||
465 | } | ||
466 | |||
467 | return null; | ||
468 | } | ||
469 | |||
470 | public InventoryFolderBase QueryFolder(string userID, InventoryFolderBase folder, UUID sessionID) | ||
471 | { | ||
472 | try | ||
473 | { | ||
474 | return SynchronousRestSessionObjectPoster<InventoryFolderBase, InventoryFolderBase>.BeginPostObject( | ||
475 | "POST", m_ServerURI + "/QueryFolder/", folder, sessionID.ToString(), userID); | ||
476 | } | ||
477 | catch (Exception e) | ||
478 | { | ||
479 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: Query inventory folder operation failed, {0} {1}", | ||
480 | e.Source, e.Message); | ||
481 | } | ||
482 | |||
483 | return null; | ||
484 | } | ||
485 | |||
486 | public int GetAssetPermissions(string userID, UUID assetID, UUID sessionID) | ||
487 | { | ||
488 | try | ||
489 | { | ||
490 | InventoryItemBase item = new InventoryItemBase(); | ||
491 | item.Owner = new UUID(userID); | ||
492 | item.AssetID = assetID; | ||
493 | return SynchronousRestSessionObjectPoster<InventoryItemBase, int>.BeginPostObject( | ||
494 | "POST", m_ServerURI + "/AssetPermissions/", item, sessionID.ToString(), userID); | ||
495 | } | ||
496 | catch (Exception e) | ||
497 | { | ||
498 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: AssetPermissions operation failed, {0} {1}", | ||
499 | e.Source, e.Message); | ||
500 | } | ||
501 | |||
502 | return 0; | ||
503 | } | ||
504 | |||
505 | #endregion | ||
506 | |||
507 | /// <summary> | ||
508 | /// Callback used by the inventory server GetInventory request | ||
509 | /// </summary> | ||
510 | /// <param name="userID"></param> | ||
511 | private void InventoryResponse(InventoryCollection response) | ||
512 | { | ||
513 | UUID userID = response.UserID; | ||
514 | InventoryReceiptCallback callback = null; | ||
515 | lock (m_RequestingInventory) | ||
516 | { | ||
517 | if (m_RequestingInventory.ContainsKey(userID)) | ||
518 | { | ||
519 | callback = m_RequestingInventory[userID]; | ||
520 | m_RequestingInventory.Remove(userID); | ||
521 | lock (m_RequestTime) | ||
522 | { | ||
523 | if (m_RequestTime.ContainsKey(userID)) | ||
524 | { | ||
525 | m_RequestTime.Remove(userID); | ||
526 | } | ||
527 | } | ||
528 | } | ||
529 | else | ||
530 | { | ||
531 | m_log.WarnFormat( | ||
532 | "[INVENTORY CONNECTOR]: " + | ||
533 | "Received inventory response for {0} for which we do not have a record of requesting!", | ||
534 | userID); | ||
535 | return; | ||
536 | } | ||
537 | } | ||
538 | |||
539 | m_log.InfoFormat("[INVENTORY CONNECTOR]: " + | ||
540 | "Received inventory response for user {0} containing {1} folders and {2} items", | ||
541 | userID, response.Folders.Count, response.Items.Count); | ||
542 | |||
543 | InventoryFolderImpl rootFolder = null; | ||
544 | |||
545 | ICollection<InventoryFolderImpl> folders = new List<InventoryFolderImpl>(); | ||
546 | ICollection<InventoryItemBase> items = new List<InventoryItemBase>(); | ||
547 | |||
548 | foreach (InventoryFolderBase folder in response.Folders) | ||
549 | { | ||
550 | if (folder.ParentID == UUID.Zero) | ||
551 | { | ||
552 | rootFolder = new InventoryFolderImpl(folder); | ||
553 | folders.Add(rootFolder); | ||
554 | |||
555 | break; | ||
556 | } | ||
557 | } | ||
558 | |||
559 | if (rootFolder != null) | ||
560 | { | ||
561 | foreach (InventoryFolderBase folder in response.Folders) | ||
562 | { | ||
563 | if (folder.ID != rootFolder.ID) | ||
564 | { | ||
565 | folders.Add(new InventoryFolderImpl(folder)); | ||
566 | } | ||
567 | } | ||
568 | |||
569 | foreach (InventoryItemBase item in response.Items) | ||
570 | { | ||
571 | items.Add(item); | ||
572 | } | ||
573 | } | ||
574 | else | ||
575 | { | ||
576 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: Did not get back an inventory containing a root folder for user {0}", userID); | ||
577 | } | ||
578 | |||
579 | callback(folders, items); | ||
580 | } | ||
581 | } | ||
582 | } | ||
diff --git a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs deleted file mode 100644 index a7aa138..0000000 --- a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs +++ /dev/null | |||
@@ -1,196 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using log4net; | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.IO; | ||
32 | using System.Reflection; | ||
33 | using Nini.Config; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Framework.Servers.HttpServer; | ||
36 | using OpenSim.Services.Interfaces; | ||
37 | using OpenMetaverse; | ||
38 | |||
39 | namespace OpenSim.Services.Connectors | ||
40 | { | ||
41 | /// <summary> | ||
42 | /// This connector is temporary. It's used by the user server, before that server is refactored. | ||
43 | /// </summary> | ||
44 | public class QuickAndDirtyInventoryServiceConnector : IInventoryService | ||
45 | { | ||
46 | // private static readonly ILog m_log = | ||
47 | // LogManager.GetLogger( | ||
48 | // MethodBase.GetCurrentMethod().DeclaringType); | ||
49 | |||
50 | private string m_ServerURI = String.Empty; | ||
51 | |||
52 | //private Dictionary<UUID, InventoryReceiptCallback> m_RequestingInventory = new Dictionary<UUID, InventoryReceiptCallback>(); | ||
53 | |||
54 | public QuickAndDirtyInventoryServiceConnector() | ||
55 | { | ||
56 | } | ||
57 | |||
58 | public QuickAndDirtyInventoryServiceConnector(string serverURI) | ||
59 | { | ||
60 | m_ServerURI = serverURI.TrimEnd('/'); | ||
61 | } | ||
62 | |||
63 | /// <summary> | ||
64 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> | ||
65 | /// </summary> | ||
66 | /// <param name="userId"></param> | ||
67 | /// <returns></returns> | ||
68 | public bool CreateUserInventory(UUID userId) | ||
69 | { | ||
70 | return SynchronousRestObjectPoster.BeginPostObject<Guid, bool>( | ||
71 | "POST", m_ServerURI + "CreateInventory/", userId.Guid); | ||
72 | } | ||
73 | |||
74 | /// <summary> | ||
75 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> | ||
76 | /// </summary> | ||
77 | /// <param name="userId"></param> | ||
78 | /// <returns></returns> | ||
79 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | ||
80 | { | ||
81 | return SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>( | ||
82 | "POST", m_ServerURI + "RootFolders/", userId.Guid); | ||
83 | } | ||
84 | |||
85 | /// <summary> | ||
86 | /// Returns a list of all the active gestures in a user's inventory. | ||
87 | /// </summary> | ||
88 | /// <param name="userId"> | ||
89 | /// The <see cref="UUID"/> of the user | ||
90 | /// </param> | ||
91 | /// <returns> | ||
92 | /// A flat list of the gesture items. | ||
93 | /// </returns> | ||
94 | public List<InventoryItemBase> GetActiveGestures(UUID userId) | ||
95 | { | ||
96 | return SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryItemBase>>( | ||
97 | "POST", m_ServerURI + "ActiveGestures/", userId.Guid); | ||
98 | } | ||
99 | |||
100 | public InventoryCollection GetUserInventory(UUID userID) | ||
101 | { | ||
102 | return null; | ||
103 | } | ||
104 | |||
105 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) | ||
106 | { | ||
107 | } | ||
108 | |||
109 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | ||
110 | { | ||
111 | return null; | ||
112 | } | ||
113 | |||
114 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) | ||
115 | { | ||
116 | return null; | ||
117 | } | ||
118 | |||
119 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | ||
120 | { | ||
121 | return null; | ||
122 | } | ||
123 | |||
124 | public bool AddFolder(InventoryFolderBase folder) | ||
125 | { | ||
126 | return false; | ||
127 | } | ||
128 | |||
129 | public bool UpdateFolder(InventoryFolderBase folder) | ||
130 | { | ||
131 | return false; | ||
132 | } | ||
133 | |||
134 | public bool MoveFolder(InventoryFolderBase folder) | ||
135 | { | ||
136 | return false; | ||
137 | } | ||
138 | |||
139 | public bool DeleteFolders(UUID ownerID, List<UUID> folderIDs) | ||
140 | { | ||
141 | return false; | ||
142 | } | ||
143 | |||
144 | |||
145 | public bool PurgeFolder(InventoryFolderBase folder) | ||
146 | { | ||
147 | return false; | ||
148 | } | ||
149 | |||
150 | public bool AddItem(InventoryItemBase item) | ||
151 | { | ||
152 | return false; | ||
153 | } | ||
154 | |||
155 | public bool UpdateItem(InventoryItemBase item) | ||
156 | { | ||
157 | return false; | ||
158 | } | ||
159 | |||
160 | public bool MoveItems(UUID ownerID, List<InventoryItemBase> items) | ||
161 | { | ||
162 | return false; | ||
163 | } | ||
164 | |||
165 | public bool DeleteItems(UUID owner, List<UUID> itemIDs) | ||
166 | { | ||
167 | return false; | ||
168 | } | ||
169 | |||
170 | public InventoryItemBase GetItem(InventoryItemBase item) | ||
171 | { | ||
172 | return null; | ||
173 | } | ||
174 | |||
175 | public InventoryFolderBase GetFolder(InventoryFolderBase folder) | ||
176 | { | ||
177 | return null; | ||
178 | } | ||
179 | |||
180 | public bool HasInventoryForUser(UUID userID) | ||
181 | { | ||
182 | return false; | ||
183 | } | ||
184 | |||
185 | public InventoryFolderBase GetRootFolder(UUID userID) | ||
186 | { | ||
187 | return null; | ||
188 | } | ||
189 | |||
190 | public int GetAssetPermissions(UUID userID, UUID assetID) | ||
191 | { | ||
192 | return 0; | ||
193 | } | ||
194 | |||
195 | } | ||
196 | } | ||
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs new file mode 100644 index 0000000..93fdae3 --- /dev/null +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs | |||
@@ -0,0 +1,262 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using System.Net; | ||
32 | using System.IO; | ||
33 | using System.Timers; | ||
34 | using System.Drawing; | ||
35 | using System.Drawing.Imaging; | ||
36 | |||
37 | using log4net; | ||
38 | using Mono.Addins; | ||
39 | using Nini.Config; | ||
40 | using OpenSim.Framework; | ||
41 | using OpenSim.Region.Framework.Interfaces; | ||
42 | using OpenSim.Region.Framework.Scenes; | ||
43 | using OpenMetaverse; | ||
44 | using OpenMetaverse.StructuredData; | ||
45 | |||
46 | namespace OpenSim.Region.OptionalModules.Simian | ||
47 | { | ||
48 | /// <summary> | ||
49 | /// </summary> | ||
50 | /// <remarks> | ||
51 | /// </remarks> | ||
52 | |||
53 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimianGridMaptile")] | ||
54 | public class SimianGridMaptile : ISharedRegionModule | ||
55 | { | ||
56 | private static readonly ILog m_log = | ||
57 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
58 | |||
59 | private bool m_enabled = false; | ||
60 | private string m_serverUrl = String.Empty; | ||
61 | private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); | ||
62 | |||
63 | private int m_refreshtime = 0; | ||
64 | private int m_lastrefresh = 0; | ||
65 | private System.Timers.Timer m_refreshTimer = new System.Timers.Timer(); | ||
66 | |||
67 | #region ISharedRegionModule | ||
68 | |||
69 | public Type ReplaceableInterface { get { return null; } } | ||
70 | public string Name { get { return "SimianGridMaptile"; } } | ||
71 | public void RegionLoaded(Scene scene) { } | ||
72 | public void Close() { } | ||
73 | |||
74 | ///<summary> | ||
75 | /// | ||
76 | ///</summary> | ||
77 | public void Initialise(IConfigSource source) | ||
78 | { | ||
79 | IConfig config = source.Configs["SimianGridMaptiles"]; | ||
80 | if (config == null) | ||
81 | return; | ||
82 | |||
83 | if (! config.GetBoolean("Enabled", false)) | ||
84 | return; | ||
85 | |||
86 | m_serverUrl = config.GetString("MaptileURL"); | ||
87 | if (String.IsNullOrEmpty(m_serverUrl)) | ||
88 | return; | ||
89 | |||
90 | int refreshseconds = Convert.ToInt32(config.GetString("RefreshTime")); | ||
91 | if (refreshseconds <= 0) | ||
92 | return; | ||
93 | |||
94 | m_refreshtime = refreshseconds * 1000; // convert from seconds to ms | ||
95 | m_log.InfoFormat("[SIMIAN MAPTILE] enabled with refresh timeout {0} and URL {1}", | ||
96 | m_refreshtime,m_serverUrl); | ||
97 | |||
98 | m_enabled = true; | ||
99 | } | ||
100 | |||
101 | ///<summary> | ||
102 | /// | ||
103 | ///</summary> | ||
104 | public void PostInitialise() | ||
105 | { | ||
106 | if (m_enabled) | ||
107 | { | ||
108 | m_refreshTimer.Enabled = true; | ||
109 | m_refreshTimer.AutoReset = true; | ||
110 | m_refreshTimer.Interval = 5 * 60 * 1000; // every 5 minutes | ||
111 | m_refreshTimer.Elapsed += new ElapsedEventHandler(HandleMaptileRefresh); | ||
112 | } | ||
113 | } | ||
114 | |||
115 | |||
116 | ///<summary> | ||
117 | /// | ||
118 | ///</summary> | ||
119 | public void AddRegion(Scene scene) | ||
120 | { | ||
121 | if (! m_enabled) | ||
122 | return; | ||
123 | |||
124 | // Every shared region module has to maintain an indepedent list of | ||
125 | // currently running regions | ||
126 | lock (m_scenes) | ||
127 | m_scenes[scene.RegionInfo.RegionID] = scene; | ||
128 | } | ||
129 | |||
130 | ///<summary> | ||
131 | /// | ||
132 | ///</summary> | ||
133 | public void RemoveRegion(Scene scene) | ||
134 | { | ||
135 | if (! m_enabled) | ||
136 | return; | ||
137 | |||
138 | lock (m_scenes) | ||
139 | m_scenes.Remove(scene.RegionInfo.RegionID); | ||
140 | } | ||
141 | |||
142 | #endregion ISharedRegionModule | ||
143 | |||
144 | ///<summary> | ||
145 | /// | ||
146 | ///</summary> | ||
147 | private void HandleMaptileRefresh(object sender, EventArgs ea) | ||
148 | { | ||
149 | // this approach is a bit convoluted becase we want to wait for the | ||
150 | // first upload to happen on startup but after all the objects are | ||
151 | // loaded and initialized | ||
152 | if (m_lastrefresh > 0 && Util.EnvironmentTickCountSubtract(m_lastrefresh) < m_refreshtime) | ||
153 | return; | ||
154 | |||
155 | m_log.DebugFormat("[SIMIAN MAPTILE] map refresh fired"); | ||
156 | lock (m_scenes) | ||
157 | { | ||
158 | foreach (IScene scene in m_scenes.Values) | ||
159 | { | ||
160 | try | ||
161 | { | ||
162 | UploadMapTile(scene); | ||
163 | } | ||
164 | catch (Exception ex) | ||
165 | { | ||
166 | m_log.WarnFormat("[SIMIAN MAPTILE] something bad happened {0}",ex.Message); | ||
167 | } | ||
168 | } | ||
169 | } | ||
170 | |||
171 | m_lastrefresh = Util.EnvironmentTickCount(); | ||
172 | } | ||
173 | |||
174 | ///<summary> | ||
175 | /// | ||
176 | ///</summary> | ||
177 | private void UploadMapTile(IScene scene) | ||
178 | { | ||
179 | m_log.DebugFormat("[SIMIAN MAPTILE]: upload maptile for {0}",scene.RegionInfo.RegionName); | ||
180 | |||
181 | // Create a PNG map tile and upload it to the AddMapTile API | ||
182 | byte[] pngData = Utils.EmptyBytes; | ||
183 | IMapImageGenerator tileGenerator = scene.RequestModuleInterface<IMapImageGenerator>(); | ||
184 | if (tileGenerator == null) | ||
185 | { | ||
186 | m_log.Warn("[SIMIAN MAPTILE]: Cannot upload PNG map tile without an ImageGenerator"); | ||
187 | return; | ||
188 | } | ||
189 | |||
190 | using (Image mapTile = tileGenerator.CreateMapTile()) | ||
191 | { | ||
192 | using (MemoryStream stream = new MemoryStream()) | ||
193 | { | ||
194 | mapTile.Save(stream, ImageFormat.Png); | ||
195 | pngData = stream.ToArray(); | ||
196 | } | ||
197 | } | ||
198 | |||
199 | List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>() | ||
200 | { | ||
201 | new MultipartForm.Parameter("X", scene.RegionInfo.RegionLocX.ToString()), | ||
202 | new MultipartForm.Parameter("Y", scene.RegionInfo.RegionLocY.ToString()), | ||
203 | new MultipartForm.File("Tile", "tile.png", "image/png", pngData) | ||
204 | }; | ||
205 | |||
206 | string errorMessage = null; | ||
207 | int tickstart = Util.EnvironmentTickCount(); | ||
208 | |||
209 | // Make the remote storage request | ||
210 | try | ||
211 | { | ||
212 | HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl); | ||
213 | request.Timeout = 20000; | ||
214 | request.ReadWriteTimeout = 5000; | ||
215 | |||
216 | using (HttpWebResponse response = MultipartForm.Post(request, postParameters)) | ||
217 | { | ||
218 | using (Stream responseStream = response.GetResponseStream()) | ||
219 | { | ||
220 | string responseStr = responseStream.GetStreamString(); | ||
221 | OSD responseOSD = OSDParser.Deserialize(responseStr); | ||
222 | if (responseOSD.Type == OSDType.Map) | ||
223 | { | ||
224 | OSDMap responseMap = (OSDMap)responseOSD; | ||
225 | if (responseMap["Success"].AsBoolean()) | ||
226 | return; | ||
227 | |||
228 | errorMessage = "Upload failed: " + responseMap["Message"].AsString(); | ||
229 | } | ||
230 | else | ||
231 | { | ||
232 | errorMessage = "Response format was invalid:\n" + responseStr; | ||
233 | } | ||
234 | } | ||
235 | } | ||
236 | } | ||
237 | catch (WebException we) | ||
238 | { | ||
239 | errorMessage = we.Message; | ||
240 | if (we.Status == WebExceptionStatus.ProtocolError) | ||
241 | { | ||
242 | HttpWebResponse webResponse = (HttpWebResponse)we.Response; | ||
243 | errorMessage = String.Format("[{0}] {1}", | ||
244 | webResponse.StatusCode,webResponse.StatusDescription); | ||
245 | } | ||
246 | } | ||
247 | catch (Exception ex) | ||
248 | { | ||
249 | errorMessage = ex.Message; | ||
250 | } | ||
251 | finally | ||
252 | { | ||
253 | // This just dumps a warning for any operation that takes more than 100 ms | ||
254 | int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); | ||
255 | m_log.DebugFormat("[SIMIAN MAPTILE]: map tile uploaded in {0}ms",tickdiff); | ||
256 | } | ||
257 | |||
258 | m_log.WarnFormat("[SIMIAN MAPTILE]: Failed to store {0} byte tile for {1}: {2}", | ||
259 | pngData.Length, scene.RegionInfo.RegionName, errorMessage); | ||
260 | } | ||
261 | } | ||
262 | } \ No newline at end of file | ||
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 2c8277f..46ad9dd 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | |||
@@ -48,6 +48,9 @@ namespace OpenSim.Services.Connectors.Simulation | |||
48 | { | 48 | { |
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | 50 | ||
51 | // we use this dictionary to track the pending updateagent requests, maps URI --> position update | ||
52 | private Dictionary<string,AgentPosition> m_updateAgentQueue = new Dictionary<string,AgentPosition>(); | ||
53 | |||
51 | //private GridRegion m_Region; | 54 | //private GridRegion m_Region; |
52 | 55 | ||
53 | public SimulationServiceConnector() | 56 | public SimulationServiceConnector() |
@@ -133,10 +136,56 @@ namespace OpenSim.Services.Connectors.Simulation | |||
133 | /// </summary> | 136 | /// </summary> |
134 | public bool UpdateAgent(GridRegion destination, AgentPosition data) | 137 | public bool UpdateAgent(GridRegion destination, AgentPosition data) |
135 | { | 138 | { |
136 | // we need a better throttle for these | 139 | // The basic idea of this code is that the first thread that needs to |
137 | // return false; | 140 | // send an update for a specific avatar becomes the worker for any subsequent |
141 | // requests until there are no more outstanding requests. Further, only send the most | ||
142 | // recent update; this *should* never be needed but some requests get | ||
143 | // slowed down and once that happens the problem with service end point | ||
144 | // limits kicks in and nothing proceeds | ||
145 | string uri = destination.ServerURI + AgentPath() + data.AgentID + "/"; | ||
146 | lock (m_updateAgentQueue) | ||
147 | { | ||
148 | if (m_updateAgentQueue.ContainsKey(uri)) | ||
149 | { | ||
150 | // Another thread is already handling | ||
151 | // updates for this simulator, just update | ||
152 | // the position and return, overwrites are | ||
153 | // not a problem since we only care about the | ||
154 | // last update anyway | ||
155 | m_updateAgentQueue[uri] = data; | ||
156 | return true; | ||
157 | } | ||
158 | |||
159 | // Otherwise update the reference and start processing | ||
160 | m_updateAgentQueue[uri] = data; | ||
161 | } | ||
138 | 162 | ||
139 | return UpdateAgent(destination, (IAgentData)data); | 163 | AgentPosition pos = null; |
164 | while (true) | ||
165 | { | ||
166 | lock (m_updateAgentQueue) | ||
167 | { | ||
168 | // save the position | ||
169 | AgentPosition lastpos = pos; | ||
170 | |||
171 | pos = m_updateAgentQueue[uri]; | ||
172 | |||
173 | // this is true if no one put a new | ||
174 | // update in the map since the last | ||
175 | // one we processed, if thats the | ||
176 | // case then we are done | ||
177 | if (pos == lastpos) | ||
178 | { | ||
179 | m_updateAgentQueue.Remove(uri); | ||
180 | return true; | ||
181 | } | ||
182 | } | ||
183 | |||
184 | UpdateAgent(destination,(IAgentData)pos); | ||
185 | } | ||
186 | |||
187 | // unreachable | ||
188 | return true; | ||
140 | } | 189 | } |
141 | 190 | ||
142 | /// <summary> | 191 | /// <summary> |
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 125c2be..aeff9b5 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs | |||
@@ -286,7 +286,7 @@ namespace OpenSim.Services.GridService | |||
286 | } | 286 | } |
287 | 287 | ||
288 | } | 288 | } |
289 | m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighours", region.RegionName, rinfos.Count); | 289 | m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighbours", region.RegionName, rinfos.Count); |
290 | return rinfos; | 290 | return rinfos; |
291 | } | 291 | } |
292 | 292 | ||
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index c02c813..553c116 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs | |||
@@ -191,6 +191,7 @@ namespace OpenSim.Services.GridService | |||
191 | } | 191 | } |
192 | if (parts.Length >= 2) | 192 | if (parts.Length >= 2) |
193 | { | 193 | { |
194 | <<<<<<< HEAD:OpenSim/Services/GridService/HypergridLinker.cs | ||
194 | portstr = parts[1]; | 195 | portstr = parts[1]; |
195 | //m_log.Debug("-- port = " + portstr); | 196 | //m_log.Debug("-- port = " + portstr); |
196 | if (!UInt32.TryParse(portstr, out port)) | 197 | if (!UInt32.TryParse(portstr, out port)) |
@@ -219,6 +220,20 @@ namespace OpenSim.Services.GridService | |||
219 | { | 220 | { |
220 | regInfo.RegionName = mapName; | 221 | regInfo.RegionName = mapName; |
221 | return regInfo; | 222 | return regInfo; |
223 | ======= | ||
224 | string[] parts = mapName.Split(new char[] {' '}); | ||
225 | string regionName = String.Empty; | ||
226 | if (parts.Length > 1) | ||
227 | { | ||
228 | regionName = mapName.Substring(parts[0].Length + 1); | ||
229 | regionName = regionName.Trim(new char[] {'"'}); | ||
230 | } | ||
231 | if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, parts[0], ownerID, out regInfo, out reason)) | ||
232 | { | ||
233 | regInfo.RegionName = mapName; | ||
234 | return regInfo; | ||
235 | } | ||
236 | >>>>>>> master:OpenSim/Services/GridService/HypergridLinker.cs | ||
222 | } | 237 | } |
223 | 238 | ||
224 | return null; | 239 | return null; |
@@ -313,9 +328,9 @@ namespace OpenSim.Services.GridService | |||
313 | 328 | ||
314 | regInfo.RegionID = regionID; | 329 | regInfo.RegionID = regionID; |
315 | 330 | ||
316 | if ( externalName == string.Empty ) | 331 | if (externalName == string.Empty) |
317 | regInfo.RegionName = regInfo.ServerURI; | 332 | regInfo.RegionName = regInfo.ServerURI; |
318 | else | 333 | else |
319 | regInfo.RegionName = externalName; | 334 | regInfo.RegionName = externalName; |
320 | 335 | ||
321 | m_log.Debug("[HYPERGRID LINKER]: naming linked region " + regInfo.RegionName); | 336 | m_log.Debug("[HYPERGRID LINKER]: naming linked region " + regInfo.RegionName); |
diff --git a/bin/assets/TexturesAssetSet/TexturesAssetSet.xml b/bin/assets/TexturesAssetSet/TexturesAssetSet.xml index 5484ee2..3af9c99 100644 --- a/bin/assets/TexturesAssetSet/TexturesAssetSet.xml +++ b/bin/assets/TexturesAssetSet/TexturesAssetSet.xml | |||
@@ -413,6 +413,15 @@ | |||
413 | <Key Name="assetType" Value="0" /> | 413 | <Key Name="assetType" Value="0" /> |
414 | <Key Name="fileName" Value="default_clear.jp2" /> | 414 | <Key Name="fileName" Value="default_clear.jp2" /> |
415 | </Section> | 415 | </Section> |
416 | |||
417 | <!-- 3a367d1c-bef1-6d43-7595-e88c1e3aadb3 is a UUID that viewers assume exists in the asset server --> | ||
418 | <!-- See http://opensimulator.org/mantis/bug_view_advanced_page.php?bug_id=4751 for more details --> | ||
419 | <Section Name="Default Alpha Layer Texture"> | ||
420 | <Key Name="assetID" Value="3a367d1c-bef1-6d43-7595-e88c1e3aadb3"/> | ||
421 | <Key Name="name" Value="Default Alpha Layer Texture"/> | ||
422 | <Key Name="assetType" Value="0" /> | ||
423 | <Key Name="fileName" Value="default_clear.jp2" /> | ||
424 | </Section> | ||
416 | 425 | ||
417 | <Section Name="Default Avatar"> | 426 | <Section Name="Default Avatar"> |
418 | <Key Name="assetID" Value="c228d1cf-4b5d-4ba8-84f4-899a0796aa97"/> | 427 | <Key Name="assetID" Value="c228d1cf-4b5d-4ba8-84f4-899a0796aa97"/> |
diff --git a/bin/config-include/GridCommon.ini.example b/bin/config-include/GridCommon.ini.example index 761e5eb..e1bcf00 100644 --- a/bin/config-include/GridCommon.ini.example +++ b/bin/config-include/GridCommon.ini.example | |||
@@ -88,6 +88,10 @@ | |||
88 | ; accessible from other grids | 88 | ; accessible from other grids |
89 | ; | 89 | ; |
90 | ProfileServerURI = "http://mygridserver.com:8002/user" | 90 | ProfileServerURI = "http://mygridserver.com:8002/user" |
91 | ;; If you want to protect your assets from being copied by foreign visitors | ||
92 | ;; uncomment the next line. You may want to do this on sims that have licensed content. | ||
93 | ; OutboundPermission = False | ||
94 | |||
91 | 95 | ||
92 | [Modules] | 96 | [Modules] |
93 | ;; Choose 0 or 1 cache modules, and the corresponding config file, if it exists. | 97 | ;; Choose 0 or 1 cache modules, and the corresponding config file, if it exists. |
diff --git a/bin/config-include/HyperSimianGrid.ini b/bin/config-include/HyperSimianGrid.ini index 0b01116..89d6be7 100644 --- a/bin/config-include/HyperSimianGrid.ini +++ b/bin/config-include/HyperSimianGrid.ini | |||
@@ -82,3 +82,14 @@ | |||
82 | 82 | ||
83 | [Profiles] | 83 | [Profiles] |
84 | Module = "SimianProfiles" | 84 | Module = "SimianProfiles" |
85 | |||
86 | [HGInventoryAccessModule] | ||
87 | ; | ||
88 | ; === HG ONLY === | ||
89 | ; Change this to your profile server | ||
90 | ; accessible from other grids | ||
91 | ; | ||
92 | ProfileServerURI = "http://mygridserver.com:8002/user" | ||
93 | ;; If you want to protect your assets from being copied by foreign visitors | ||
94 | ;; uncomment the next line. You may want to do this on sims that have licensed content. | ||
95 | ; OutboundPermission = False | ||
diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example index 4956bc3..213219c 100644 --- a/bin/config-include/StandaloneCommon.ini.example +++ b/bin/config-include/StandaloneCommon.ini.example | |||
@@ -33,6 +33,10 @@ | |||
33 | 33 | ||
34 | [HGInventoryAccessModule] | 34 | [HGInventoryAccessModule] |
35 | ProfileServerURI = "http://127.0.0.1:9000/profiles" | 35 | ProfileServerURI = "http://127.0.0.1:9000/profiles" |
36 | ;; If you want to protect your assets from being copied by foreign visitors | ||
37 | ;; uncomment the next line. You may want to do this on sims that have licensed content. | ||
38 | ; OutboundPermission = False | ||
39 | |||
36 | 40 | ||
37 | [Modules] | 41 | [Modules] |
38 | ;; Choose 0 or 1 cache modules, and the corresponding config file, if it exists. | 42 | ;; Choose 0 or 1 cache modules, and the corresponding config file, if it exists. |