diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs index 7ef0f5f455..f37c399050 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs @@ -122,9 +122,11 @@ namespace OpenSim.ApplicationPlugins.LoadRegions m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + Thread.CurrentThread.ManagedThreadId.ToString() + ")"); + m_openSim.PopulateRegionEstateInfo(regionsToLoad[i]); m_openSim.CreateRegion(regionsToLoad[i], true, out scene); regionsToLoad[i].EstateSettings.Save(); + if (scene != null) { m_newRegionCreatedHandler = OnNewRegionCreated; diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs index 019ca73dd1..0188eb716e 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs @@ -44,7 +44,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory // private static readonly int PARM_PATH = 1; - private bool enabled = false; +// private bool enabled = false; private string qPrefix = "appearance"; /// @@ -74,7 +74,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory // Activate if everything went OK - enabled = true; +// enabled = true; Rest.Log.InfoFormat("{0} User appearance services initialization complete", MsgId); } @@ -95,7 +95,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory public void Close() { - enabled = false; +// enabled = false; Rest.Log.InfoFormat("{0} User appearance services closing down", MsgId); } diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs index c3cf08c18d..b4156621bb 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs @@ -46,12 +46,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory public class RestInventoryServices : IRest { // private static readonly int PARM_USERID = 0; - private static readonly int PARM_PATH = 1; +// private static readonly int PARM_PATH = 1; // private bool enabled = false; private string qPrefix = "inventory"; - private static readonly string PRIVATE_ROOT_NAME = "My Inventory"; +// private static readonly string PRIVATE_ROOT_NAME = "My Inventory"; /// /// The constructor makes sure that the service prefix is absolute diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 97baaea04b..f646fcdc76 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -669,10 +669,6 @@ namespace OpenSim.Data.SQLite } } - /// - /// - /// - /// public void RemoveLandObject(UUID globalID) { lock (ds) @@ -698,7 +694,6 @@ namespace OpenSim.Data.SQLite if (landRow != null) { landRow.Delete(); - land.Rows.Remove(landRow); } List rowsToDelete = new List(); foreach (DataRow rowToCheck in landaccesslist.Rows) @@ -709,7 +704,6 @@ namespace OpenSim.Data.SQLite for (int iter = 0; iter < rowsToDelete.Count; iter++) { rowsToDelete[iter].Delete(); - landaccesslist.Rows.Remove(rowsToDelete[iter]); } } Commit(); diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs index 1600bdc00d..3dbc215d46 100644 --- a/OpenSim/Framework/AgentCircuitData.cs +++ b/OpenSim/Framework/AgentCircuitData.cs @@ -220,6 +220,8 @@ namespace OpenSim.Framework args["packed_appearance"] = appmap; } + // Old, bad way. Keeping it fow now for backwards compatibility + // OBSOLETE -- soon to be deleted if (ServiceURLs != null && ServiceURLs.Count > 0) { OSDArray urls = new OSDArray(ServiceURLs.Count * 2); @@ -232,6 +234,19 @@ namespace OpenSim.Framework args["service_urls"] = urls; } + // again, this time the right way + if (ServiceURLs != null && ServiceURLs.Count > 0) + { + OSDMap urls = new OSDMap(); + foreach (KeyValuePair kvp in ServiceURLs) + { + //System.Console.WriteLine("XXX " + kvp.Key + "=" + kvp.Value); + urls[kvp.Key] = OSD.FromString((kvp.Value == null) ? string.Empty : kvp.Value.ToString()); + } + args["serviceurls"] = urls; + } + + return args; } @@ -327,7 +342,20 @@ namespace OpenSim.Framework } ServiceURLs = new Dictionary(); - if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array) + // Try parse the new way, OSDMap + if (args.ContainsKey("serviceurls") && args["serviceurls"] != null && (args["serviceurls"]).Type == OSDType.Map) + { + OSDMap urls = (OSDMap)(args["serviceurls"]); + foreach (KeyValuePair kvp in urls) + { + ServiceURLs[kvp.Key] = kvp.Value.AsString(); + //System.Console.WriteLine("XXX " + kvp.Key + "=" + ServiceURLs[kvp.Key]); + + } + } + // else try the old way, OSDArray + // OBSOLETE -- soon to be deleted + else if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array) { OSDArray urls = (OSDArray)(args["service_urls"]); for (int i = 0; i < urls.Count / 2; i++) diff --git a/OpenSim/Framework/Capabilities/CapsHandlers.cs b/OpenSim/Framework/Capabilities/CapsHandlers.cs index 864e6ddb7e..e1c800e907 100644 --- a/OpenSim/Framework/Capabilities/CapsHandlers.cs +++ b/OpenSim/Framework/Capabilities/CapsHandlers.cs @@ -88,8 +88,8 @@ namespace OpenSim.Framework.Capabilities /// handler to be removed public void Remove(string capsName) { - // This line must be here, or caps will break! m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[capsName].Path); + m_httpListener.RemoveStreamHandler("GET", m_capsHandlers[capsName].Path); m_capsHandlers.Remove(capsName); } diff --git a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs index d5e84c779e..f138437ad5 100644 --- a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs +++ b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs @@ -303,7 +303,7 @@ namespace OpenSim.Framework.Serialization.External writer.WriteStartElement("GroupOwned"); writer.WriteString(inventoryItem.GroupOwned.ToString()); writer.WriteEndElement(); - if (inventoryItem.CreatorData != null && inventoryItem.CreatorData != string.Empty) + if (options.ContainsKey("creators") && inventoryItem.CreatorData != null && inventoryItem.CreatorData != string.Empty) writer.WriteElementString("CreatorData", inventoryItem.CreatorData); else if (options.ContainsKey("profile")) { diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index b28ad69a5e..21e1e09b70 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -319,18 +319,21 @@ namespace OpenSim.Framework.Servers return; } - string rawLevel = cmd[3]; - - ILoggerRepository repository = LogManager.GetRepository(); - Level consoleLevel = repository.LevelMap[rawLevel]; - - if (consoleLevel != null) - m_consoleAppender.Threshold = consoleLevel; - else - Notice( - String.Format( - "{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF", - rawLevel)); + if (cmd.Length > 3) + { + string rawLevel = cmd[3]; + + ILoggerRepository repository = LogManager.GetRepository(); + Level consoleLevel = repository.LevelMap[rawLevel]; + + if (consoleLevel != null) + m_consoleAppender.Threshold = consoleLevel; + else + Notice( + String.Format( + "{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF", + rawLevel)); + } Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold)); } diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index d4ee7ba56d..4c35132ad1 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -143,6 +143,11 @@ namespace OpenSim.Framework.Servers.HttpServer } } + public List GetStreamHandlerKeys() + { + return new List(m_streamHandlers.Keys); + } + private static string GetHandlerKey(string httpMethod, string path) { return httpMethod + ":" + path; @@ -179,6 +184,11 @@ namespace OpenSim.Framework.Servers.HttpServer } } + public List GetXmlRpcHandlerKeys() + { + return new List(m_rpcHandlers.Keys); + } + public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler) { //m_log.DebugFormat("[BASE HTTP SERVER]: Registering {0}", methodName); @@ -196,6 +206,12 @@ namespace OpenSim.Framework.Servers.HttpServer return false; } + public List GetHTTPHandlerKeys() + { + return new List(m_HTTPHandlers.Keys); + } + + public bool AddPollServiceHTTPHandler(string methodName, GenericHTTPMethod handler, PollServiceEventArgs args) { bool pollHandlerResult = false; @@ -214,6 +230,12 @@ namespace OpenSim.Framework.Servers.HttpServer return false; } + public List GetPollServiceHandlerKeys() + { + return new List(m_pollHandlers.Keys); + } + + // Note that the agent string is provided simply to differentiate // the handlers - it is NOT required to be an actual agent header // value. @@ -232,6 +254,11 @@ namespace OpenSim.Framework.Servers.HttpServer return false; } + public List GetAgentHandlerKeys() + { + return new List(m_agentHandlers.Keys); + } + public bool AddLLSDHandler(string path, LLSDMethod handler) { lock (m_llsdHandlers) @@ -245,6 +272,11 @@ namespace OpenSim.Framework.Servers.HttpServer return false; } + public List GetLLSDHandlerKeys() + { + return new List(m_llsdHandlers.Keys); + } + public bool SetDefaultLLSDHandler(DefaultLLSDMethod handler) { m_defaultLlsdHandler = handler; diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index d1d8736062..533e53abd5 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1334,6 +1334,11 @@ namespace OpenSim.Framework return (ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri; } + public static byte[] StringToBytes256(string str, params object[] args) + { + return StringToBytes256(string.Format(str, args)); + } + public static byte[] StringToBytes256(string str) { if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; } @@ -1352,6 +1357,11 @@ namespace OpenSim.Framework return data; } + public static byte[] StringToBytes1024(string str, params object[] args) + { + return StringToBytes1024(string.Format(str, args)); + } + public static byte[] StringToBytes1024(string str) { if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; } diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index d731ac5882..1feeeb31e5 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -29,6 +29,7 @@ using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; +using System.Globalization; using System.IO; using System.Net; using System.Net.Security; @@ -557,34 +558,27 @@ namespace OpenSim.Framework { float qx = GetQ(x); float qy = GetQ(y); - if (qx < qy) - return -1; - if (qx == qy) - return 0; - return 1; + return qy.CompareTo(qx); // descending order } private float GetQ(Object o) { // Example: image/png;q=0.9 + float qvalue = 1F; if (o is String) { string mime = (string)o; - string[] parts = mime.Split(new char[] { ';' }); + string[] parts = mime.Split(';'); if (parts.Length > 1) { - string[] kvp = parts[1].Split(new char[] { '=' }); + string[] kvp = parts[1].Split('='); if (kvp.Length == 2 && kvp[0] == "q") - { - float qvalue = 1F; - float.TryParse(kvp[1], out qvalue); - return qvalue; - } + float.TryParse(kvp[1], NumberStyles.Number, CultureInfo.InvariantCulture, out qvalue); } } - return 1F; + return qvalue; } } diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 5a6965b011..3618e442bb 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -294,6 +294,18 @@ namespace OpenSim "show connections", "Show connection data", HandleShow); + m_console.Commands.AddCommand("region", false, "show circuits", + "show circuits", + "Show agent circuit data", HandleShow); + + m_console.Commands.AddCommand("region", false, "show http-handlers", + "show http-handlers", + "Show all registered http handlers", HandleShow); + + m_console.Commands.AddCommand("region", false, "show pending-objects", + "show pending-objects", + "Show # of objects on the pending queues of all scene viewers", HandleShow); + m_console.Commands.AddCommand("region", false, "show modules", "show modules", "Show module data", HandleShow); @@ -994,6 +1006,66 @@ namespace OpenSim MainConsole.Instance.Output(connections.ToString()); break; + case "circuits": + System.Text.StringBuilder acd = new System.Text.StringBuilder("Agent Circuits:\n"); + m_sceneManager.ForEachScene( + delegate(Scene scene) + { + //this.HttpServer. + acd.AppendFormat("{0}:\n", scene.RegionInfo.RegionName); + foreach (AgentCircuitData aCircuit in scene.AuthenticateHandler.AgentCircuits.Values) + acd.AppendFormat("\t{0} {1} ({2})\n", aCircuit.firstname, aCircuit.lastname, (aCircuit.child ? "Child" : "Root")); + } + ); + + MainConsole.Instance.Output(acd.ToString()); + break; + + case "http-handlers": + System.Text.StringBuilder handlers = new System.Text.StringBuilder("Registered HTTP Handlers:\n"); + + handlers.AppendFormat("* XMLRPC:\n"); + foreach (String s in HttpServer.GetXmlRpcHandlerKeys()) + handlers.AppendFormat("\t{0}\n", s); + + handlers.AppendFormat("* HTTP:\n"); + List poll = HttpServer.GetPollServiceHandlerKeys(); + foreach (String s in HttpServer.GetHTTPHandlerKeys()) + handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty)); + + handlers.AppendFormat("* Agent:\n"); + foreach (String s in HttpServer.GetAgentHandlerKeys()) + handlers.AppendFormat("\t{0}\n", s); + + handlers.AppendFormat("* LLSD:\n"); + foreach (String s in HttpServer.GetLLSDHandlerKeys()) + handlers.AppendFormat("\t{0}\n", s); + + handlers.AppendFormat("* StreamHandlers ({0}):\n", HttpServer.GetStreamHandlerKeys().Count); + foreach (String s in HttpServer.GetStreamHandlerKeys()) + handlers.AppendFormat("\t{0}\n", s); + + MainConsole.Instance.Output(handlers.ToString()); + break; + + case "pending-objects": + System.Text.StringBuilder pending = new System.Text.StringBuilder("Pending objects:\n"); + m_sceneManager.ForEachScene( + delegate(Scene scene) + { + scene.ForEachScenePresence( + delegate(ScenePresence sp) + { + pending.AppendFormat("{0}: {1} {2} pending\n", + scene.RegionInfo.RegionName, sp.Name, sp.SceneViewer.GetPendingObjectsCount()); + } + ); + } + ); + + MainConsole.Instance.Output(pending.ToString()); + break; + case "modules": MainConsole.Instance.Output("The currently loaded shared modules are:"); foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules) @@ -1009,11 +1081,12 @@ namespace OpenSim delegate(Scene scene) { MainConsole.Instance.Output(String.Format( - "Region Name: {0}, Region XLoc: {1}, Region YLoc: {2}, Region Port: {3}", + "Region Name: {0}, Region XLoc: {1}, Region YLoc: {2}, Region Port: {3}, Estate Name: {4}", scene.RegionInfo.RegionName, scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY, - scene.RegionInfo.InternalEndPoint.Port)); + scene.RegionInfo.InternalEndPoint.Port, + scene.RegionInfo.EstateSettings.EstateName)); }); break; diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 6db3367673..b0bc6bedf7 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -801,9 +801,7 @@ namespace OpenSim /// /// Load the estate information for the provided RegionInfo object. /// - /// - /// A - /// + /// public void PopulateRegionEstateInfo(RegionInfo regInfo) { IEstateDataService estateDataService = EstateDataService; @@ -825,7 +823,13 @@ namespace OpenSim regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, true); regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName); - //regInfo.EstateSettings.Save(); + + // FIXME: Later on, the scene constructor will reload the estate settings no matter what. + // Therefore, we need to do an initial save here otherwise the new estate name will be reset + // back to the default. The reloading of estate settings by scene could be eliminated if it + // knows that the passed in settings in RegionInfo are already valid. Also, it might be + // possible to eliminate some additional later saves made by callers of this method. + regInfo.EstateSettings.Save(); break; } else diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs index d4c33075eb..65a8fe3ca8 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs @@ -122,6 +122,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP public int PacketsReceived; /// Number of packets sent to this client public int PacketsSent; + /// Number of packets resent to this client + public int PacketsResent; /// Total byte count of unacked packets sent to this client public int UnackedBytes; @@ -256,9 +258,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP public string GetStats() { return string.Format( - "{0,7} {1,7} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}", + "{0,7} {1,7} {2,7} {3,9} {4,7} {5,7} {6,7} {7,7} {8,7} {9,8} {10,7} {11,7}", + PacketsReceived, PacketsSent, - PacketsReceived, + PacketsResent, UnackedBytes, m_packetOutboxes[(int)ThrottleOutPacketType.Resend].Count, m_packetOutboxes[(int)ThrottleOutPacketType.Land].Count, @@ -441,13 +444,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// an outgoing packet from each, obeying the throttling bucket limits /// /// + /// /// Packet queues are inspected in ascending numerical order starting from 0. Therefore, queues with a lower /// ThrottleOutPacketType number will see their packet get sent first (e.g. if both Land and Wind queues have /// packets, then the packet at the front of the Land queue will be sent before the packet at the front of the /// wind queue). /// - /// This function is only called from a synchronous loop in the - /// UDPServer so we don't need to bother making this thread safe + /// This function is only called from a synchronous loop in the + /// UDPServer so we don't need to bother making this thread safe + /// + /// /// True if any packets were sent, otherwise false public bool DequeueOutgoing() { @@ -476,7 +482,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_udpServer.SendPacketFinal(nextPacket); m_nextPackets[i] = null; packetSent = true; - this.PacketsSent++; } } else @@ -493,7 +498,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Send the packet m_udpServer.SendPacketFinal(packet); packetSent = true; - this.PacketsSent++; } else { diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index b2e5963c0a..0cadd04e4d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -27,6 +27,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Net; using System.Net.Sockets; @@ -506,7 +507,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Bump up the resend count on this packet Interlocked.Increment(ref outgoingPacket.ResendCount); - //Interlocked.Increment(ref Stats.ResentPackets); // Requeue or resend the packet if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, false)) @@ -582,6 +582,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP udpClient.NeedAcks.Add(outgoingPacket); } } + else + { + Interlocked.Increment(ref udpClient.PacketsResent); + } #endregion Sequence Number Assignment @@ -636,10 +640,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { object[] array = new object[] { buffer, packet }; - if (m_asyncPacketHandling) - Util.FireAndForget(HandleUseCircuitCode, array); - else - HandleUseCircuitCode(array); + Util.FireAndForget(HandleUseCircuitCode, array); return; } @@ -856,10 +857,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Begin the process of adding the client to the simulator AddNewClient((UseCircuitCodePacket)packet, remoteEndPoint); - // Acknowledge the UseCircuitCode packet + // Send ack SendAckImmediate(remoteEndPoint, packet.Header.Sequence); - -// m_log.DebugFormat( + + // m_log.DebugFormat( // "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms", // buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds); } @@ -923,30 +924,37 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected virtual void AddClient(uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo) { - // Create the LLUDPClient - LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO); - IClientAPI existingClient; - // REGION SYNC (Load Balancing) - ScenePresence presence; - m_scene.TryGetScenePresence(agentID, out presence); - bool syncedAvatar = (presence != null && presence.IsSyncedAvatar); + //ScenePresence presence; + //m_scene.TryGetScenePresence(agentID, out presence); + //bool syncedAvatar = (presence != null && presence.IsSyncedAvatar); - if (!m_scene.TryGetClient(agentID, out existingClient) || syncedAvatar) + // In priciple there shouldn't be more than one thread here, ever. + // But in case that happens, we need to synchronize this piece of code + // because it's too important + lock (this) { - // Create the LLClientView - LLClientView client = new LLClientView(remoteEndPoint, m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); - client.OnLogout += LogoutHandler; + IClientAPI existingClient; - client.DisableFacelights = m_disableFacelights; + if (!m_scene.TryGetClient(agentID, out existingClient)) + { + // Create the LLUDPClient + LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO); + // Create the LLClientView + LLClientView client = new LLClientView(remoteEndPoint, m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); + client.OnLogout += LogoutHandler; - // Start the IClientAPI - client.Start(); - } - else - { - m_log.WarnFormat("[LLUDPSERVER]: Ignoring a repeated UseCircuitCode from {0} at {1} for circuit {2}", - udpClient.AgentID, remoteEndPoint, circuitCode); + client.DisableFacelights = m_disableFacelights; + + // Start the IClientAPI + client.Start(); + + } + else + { + m_log.WarnFormat("[LLUDPSERVER]: Ignoring a repeated UseCircuitCode from {0} at {1} for circuit {2}", + existingClient.AgentId, remoteEndPoint, circuitCode); + } } } @@ -1055,6 +1063,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP #endregion Update Timers + // Use this for emergency monitoring -- bug hunting + //if (m_scene.EmergencyMonitoring) + // clientPacketHandler = MonitoredClientOutgoingPacketHandler; + //else + // clientPacketHandler = ClientOutgoingPacketHandler; + // Handle outgoing packets, resends, acknowledgements, and pings for each // client. m_packetSent will be set to true if a packet is sent m_scene.ForEachClient(clientPacketHandler); @@ -1070,6 +1084,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { m_log.Error("[LLUDPSERVER]: OutgoingPacketHandler loop threw an exception: " + ex.Message, ex); } + } Watchdog.RemoveThread(); @@ -1107,6 +1122,112 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } + #region Emergency Monitoring + // Alternative packet handler fuull of instrumentation + // Handy for hunting bugs + private Stopwatch watch1 = new Stopwatch(); + private Stopwatch watch2 = new Stopwatch(); + + private float avgProcessingTicks = 0; + private float avgResendUnackedTicks = 0; + private float avgSendAcksTicks = 0; + private float avgSendPingTicks = 0; + private float avgDequeueTicks = 0; + private long nticks = 0; + private long nticksUnack = 0; + private long nticksAck = 0; + private long nticksPing = 0; + private int npacksSent = 0; + private int npackNotSent = 0; + + private void MonitoredClientOutgoingPacketHandler(IClientAPI client) + { + nticks++; + watch1.Start(); + try + { + if (client is LLClientView) + { + LLUDPClient udpClient = ((LLClientView)client).UDPClient; + + if (udpClient.IsConnected) + { + if (m_resendUnacked) + { + nticksUnack++; + watch2.Start(); + + ResendUnacked(udpClient); + + watch2.Stop(); + avgResendUnackedTicks = (nticksUnack - 1)/(float)nticksUnack * avgResendUnackedTicks + (watch2.ElapsedTicks / (float)nticksUnack); + watch2.Reset(); + } + + if (m_sendAcks) + { + nticksAck++; + watch2.Start(); + + SendAcks(udpClient); + + watch2.Stop(); + avgSendAcksTicks = (nticksAck - 1) / (float)nticksAck * avgSendAcksTicks + (watch2.ElapsedTicks / (float)nticksAck); + watch2.Reset(); + } + + if (m_sendPing) + { + nticksPing++; + watch2.Start(); + + SendPing(udpClient); + + watch2.Stop(); + avgSendPingTicks = (nticksPing - 1) / (float)nticksPing * avgSendPingTicks + (watch2.ElapsedTicks / (float)nticksPing); + watch2.Reset(); + } + + watch2.Start(); + // Dequeue any outgoing packets that are within the throttle limits + if (udpClient.DequeueOutgoing()) + { + m_packetSent = true; + npacksSent++; + } + else + npackNotSent++; + + watch2.Stop(); + avgDequeueTicks = (nticks - 1) / (float)nticks * avgDequeueTicks + (watch2.ElapsedTicks / (float)nticks); + watch2.Reset(); + + } + else + m_log.WarnFormat("[LLUDPSERVER]: Client is not connected"); + } + } + catch (Exception ex) + { + m_log.Error("[LLUDPSERVER]: OutgoingPacketHandler iteration for " + client.Name + + " threw an exception: " + ex.Message, ex); + } + watch1.Stop(); + avgProcessingTicks = (nticks - 1) / (float)nticks * avgProcessingTicks + (watch1.ElapsedTicks / (float)nticks); + watch1.Reset(); + + // reuse this -- it's every ~100ms + if (m_scene.EmergencyMonitoring && nticks % 100 == 0) + { + m_log.InfoFormat("[LLUDPSERVER]: avg processing ticks: {0} avg unacked: {1} avg acks: {2} avg ping: {3} avg dequeue: {4} (TickCountRes: {5} sent: {6} notsent: {7})", + avgProcessingTicks, avgResendUnackedTicks, avgSendAcksTicks, avgSendPingTicks, avgDequeueTicks, TickCountResolution, npacksSent, npackNotSent); + npackNotSent = npacksSent = 0; + } + + } + + #endregion + private void ProcessInPacket(object state) { IncomingPacket incomingPacket = (IncomingPacket)state; diff --git a/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs b/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs index bdbd2848c6..0a8331f32a 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs @@ -210,6 +210,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP content = Math.Min(content + dripAmount, maxBurst); lastDrip = now; + if (dripAmount < 0 || content < 0) + // sim has been idle for too long, integer has overflown + // previous calculation is meaningless, let's put it at correct max + content = maxBurst; + return true; } } diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs index 9d40688ac6..d195110a23 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs @@ -143,7 +143,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Process all the pending adds OutgoingPacket pendingAdd; while (m_pendingAdds.TryDequeue(out pendingAdd)) - m_packets[pendingAdd.SequenceNumber] = pendingAdd; + if (pendingAdd != null) + m_packets[pendingAdd.SequenceNumber] = pendingAdd; // Process all the pending removes, including updating statistics and round-trip times PendingAck pendingRemove; @@ -152,17 +153,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) { - m_packets.Remove(pendingRemove.SequenceNumber); - - // Update stats - Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength); - - if (!pendingRemove.FromResend) + if (ackedPacket != null) { - // Calculate the round-trip time for this packet and its ACK - int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount; - if (rtt > 0) - ackedPacket.Client.UpdateRoundTrip(rtt); + m_packets.Remove(pendingRemove.SequenceNumber); + + // Update stats + Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength); + + if (!pendingRemove.FromResend) + { + // Calculate the round-trip time for this packet and its ACK + int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount; + if (rtt > 0) + ackedPacket.Client.UpdateRoundTrip(rtt); + } } } } diff --git a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs index c023a6f738..1d8e70ed54 100644 --- a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs @@ -26,12 +26,14 @@ */ using System; +using System.Collections; using System.Collections.Generic; using System.Reflection; using log4net; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; +using OpenSim.Framework.Console; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using Caps=OpenSim.Framework.Capabilities.Caps; @@ -61,6 +63,9 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities { m_scene = scene; m_scene.RegisterModuleInterface(this); + MainConsole.Instance.Commands.AddCommand("Capabilities", false, "show caps", + "show capabilities", + "Shows all registered capabilities", CapabilitiesCommand); } public void RegionLoaded(Scene scene) @@ -72,7 +77,9 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities m_scene.UnregisterModuleInterface(this); } - public void PostInitialise() {} + public void PostInitialise() + { + } public void Close() {} @@ -226,5 +233,23 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities m_log.Info(" >> "+x+", "+y+": "+kvp.Value); } } + + private void CapabilitiesCommand(string module, string[] cmdparams) + { + System.Text.StringBuilder caps = new System.Text.StringBuilder(); + caps.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName); + + foreach (KeyValuePair kvp in m_capsHandlers) + { + caps.AppendFormat("** User {0}:\n", kvp.Key); + for (IDictionaryEnumerator kvp2 = kvp.Value.CapsHandlers.CapsDetails.GetEnumerator(); kvp2.MoveNext(); ) + { + Uri uri = new Uri(kvp2.Value.ToString()); + caps.AppendFormat(" {0} = {1}\n", kvp2.Key, uri.PathAndQuery); + } + } + + MainConsole.Instance.Output(caps.ToString()); + } } } diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs index 6fb8b4625c..df4d561024 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 WriteTextureData(httpRequest, httpResponse, texture, format); return true; } - } // not found - m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found"); +// m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found"); httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; return true; - } 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 1a96098f18..26edba4b6c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -128,6 +128,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver + " is the user's last name." + Environment.NewLine + " is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine + "-p|--profile= adds the url of the profile service to the saved user information." + Environment.NewLine + + "-c|--creators preserves information about foreign creators." + Environment.NewLine + "-v|--verbose extra debug messages." + Environment.NewLine + " is the filesystem path at which to save the IAR." + string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME), @@ -396,6 +397,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver //ops.Add("v|version=", delegate(string v) { options["version"] = v; }); ops.Add("p|profile=", delegate(string v) { options["profile"] = v; }); ops.Add("v|verbose", delegate(string v) { options["verbose"] = v; }); + ops.Add("c|creators", delegate(string v) { options["creators"] = v; }); List mainParams = ops.Parse(cmdparams); diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index d87f91602f..0594ffa61f 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -243,7 +243,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } catch (Exception e) { - m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Exception on teleport: {0}\n{1}", e.Message, e.StackTrace); + m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Exception on teleport: {0} {1}", e.Message, e.StackTrace); sp.ControllingClient.SendTeleportFailed("Internal error"); } } @@ -983,7 +983,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer /// public void EnableChildAgent(ScenePresence sp, GridRegion region) { - m_log.DebugFormat("[ENTITY TRANSFER]: Enabling child agent in new neighour {0}", region.RegionName); + m_log.DebugFormat("[ENTITY TRANSFER]: Enabling child agent in new neighbour {0}", region.RegionName); AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); AgentCircuitData agent = sp.ControllingClient.RequestClientInfo(); @@ -1734,4 +1734,4 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer #endregion } -} \ No newline at end of file +} diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index 34b811428d..4565d103ff 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 } private string m_ProfileServerURI; + private bool m_OutboundPermission; // private bool m_Initialized = false; @@ -78,7 +79,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess IConfig thisModuleConfig = source.Configs["HGInventoryAccessModule"]; if (thisModuleConfig != null) + { m_ProfileServerURI = thisModuleConfig.GetString("ProfileServerURI", string.Empty); + m_OutboundPermission = thisModuleConfig.GetBoolean("OutboundPermission", true); + } else m_log.Warn("[HG INVENTORY ACCESS MODULE]: HGInventoryAccessModule configs not found. ProfileServerURI not set!"); } @@ -103,7 +107,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess public void UploadInventoryItem(UUID avatarID, UUID assetID, string name, int userlevel) { string userAssetServer = string.Empty; - if (IsForeignUser(avatarID, out userAssetServer)) + if (IsForeignUser(avatarID, out userAssetServer) && m_OutboundPermission) { Util.FireAndForget(delegate { m_assMapper.Post(assetID, avatarID, userAssetServer); }); } @@ -197,7 +201,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess if (IsForeignUser(sender, out userAssetServer)) m_assMapper.Get(item.AssetID, sender, userAssetServer); - if (IsForeignUser(receiver, out userAssetServer)) + if (IsForeignUser(receiver, out userAssetServer) && m_OutboundPermission) m_assMapper.Post(item.AssetID, receiver, userAssetServer); } diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index 43de2abd15..a9d247a2b8 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml @@ -47,7 +47,6 @@ - diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs index 01a2615dc0..66994facff 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs @@ -139,7 +139,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization if (scene != null) { - UserAccount account = scene.UserAccountService.GetUserAccount(UUID.Zero, userID); + UserAccount account = scene.UserAccountService.GetUserAccount(UUID.Zero, new UUID(userID)); isAuthorized = IsAuthorizedForRegion(userID, account.FirstName, account.LastName, account.Email, scene.RegionInfo.RegionName, regionID, out message); } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs index 9315c1449a..2a10f8461d 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs @@ -247,13 +247,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid public void NeighboursCommand(string module, string[] cmdparams) { + System.Text.StringBuilder caps = new System.Text.StringBuilder(); + foreach (KeyValuePair kvp in m_LocalCache) { - m_log.InfoFormat("*** Neighbours of {0} {1} ***", kvp.Key, kvp.Value.RegionName); + caps.AppendFormat("*** Neighbours of {0} ({1}) ***\n", kvp.Value.RegionName, kvp.Key); List regions = kvp.Value.GetNeighbours(); foreach (GridRegion r in regions) - m_log.InfoFormat(" {0} @ {1}={2}", r.RegionName, r.RegionLocX / Constants.RegionSize, r.RegionLocY / Constants.RegionSize); + caps.AppendFormat(" {0} @ {1}-{2}\n", r.RegionName, r.RegionLocX / Constants.RegionSize, r.RegionLocY / Constants.RegionSize); } + + MainConsole.Instance.Output(caps.ToString()); } #region SYNC SERVER diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 39410b561b..3f63db371f 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 return; } } + else + { + m_log.DebugFormat("[HG INVENTORY CONNECTOR]: User {0} does not have InventoryServerURI. OH NOES!", userID); + return; + } } } } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs deleted file mode 100644 index 9213132866..0000000000 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs +++ /dev/null @@ -1,362 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using log4net; -using System; -using System.Collections.Generic; -using System.Reflection; -using Nini.Config; -using OpenSim.Framework; -using OpenSim.Framework.Statistics; -using OpenSim.Services.Connectors; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; -using OpenSim.Services.Interfaces; -using OpenMetaverse; - -namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory -{ - public class RemoteInventoryServicesConnector : BaseInventoryConnector, ISharedRegionModule, IInventoryService - { - private static readonly ILog m_log = - LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private bool m_Enabled = false; - private bool m_Initialized = false; - private Scene m_Scene; - private InventoryServicesConnector m_RemoteConnector; - - private IUserManagement m_UserManager; - private IUserManagement UserManager - { - get - { - if (m_UserManager == null) - { - m_UserManager = m_Scene.RequestModuleInterface(); - } - return m_UserManager; - } - } - - - public Type ReplaceableInterface - { - get { return null; } - } - - public string Name - { - get { return "RemoteInventoryServicesConnector"; } - } - - public RemoteInventoryServicesConnector() - { - } - - public RemoteInventoryServicesConnector(IConfigSource source) - { - Init(source); - } - - protected override void Init(IConfigSource source) - { - m_RemoteConnector = new InventoryServicesConnector(source); - base.Init(source); - } - - #region ISharedRegionModule - - public void Initialise(IConfigSource source) - { - IConfig moduleConfig = source.Configs["Modules"]; - if (moduleConfig != null) - { - string name = moduleConfig.GetString("InventoryServices", ""); - if (name == Name) - { - Init(source); - m_Enabled = true; - - m_log.Info("[INVENTORY CONNECTOR]: Remote inventory enabled"); - } - } - } - - public void PostInitialise() - { - } - - public void Close() - { - } - - public void AddRegion(Scene scene) - { -// m_Scene = scene; - //m_log.Debug("[XXXX] Adding scene " + m_Scene.RegionInfo.RegionName); - - if (!m_Enabled) - return; - - if (!m_Initialized) - { - m_Initialized = true; - } - - scene.RegisterModuleInterface(this); - m_cache.AddRegion(scene); - - if (m_Scene == null) - m_Scene = scene; - } - - public void RemoveRegion(Scene scene) - { - if (!m_Enabled) - return; - - m_cache.RemoveRegion(scene); - } - - public void RegionLoaded(Scene scene) - { - if (!m_Enabled) - return; - - m_log.InfoFormat("[INVENTORY CONNECTOR]: Enabled remote inventory for region {0}", scene.RegionInfo.RegionName); - - } - - #endregion ISharedRegionModule - - #region IInventoryService - - public override bool CreateUserInventory(UUID user) - { - return false; - } - - public override List GetInventorySkeleton(UUID userId) - { - return new List(); - } - - public override InventoryCollection GetUserInventory(UUID userID) - { - return null; - } - - public override void GetUserInventory(UUID userID, InventoryReceiptCallback callback) - { - UUID sessionID = GetSessionID(userID); - try - { - m_RemoteConnector.GetUserInventory(userID.ToString(), sessionID, callback); - } - catch (Exception e) - { - if (StatsManager.SimExtraStats != null) - StatsManager.SimExtraStats.AddInventoryServiceRetrievalFailure(); - - m_log.ErrorFormat("[INVENTORY CONNECTOR]: Request inventory operation failed, {0} {1}", - e.Source, e.Message); - } - - } - - // inherited. See base class - // public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) - - public override Dictionary GetSystemFolders(UUID userID) - { - UUID sessionID = GetSessionID(userID); - return m_RemoteConnector.GetSystemFolders(userID.ToString(), sessionID); - } - - public override InventoryCollection GetFolderContent(UUID userID, UUID folderID) - { - UUID sessionID = GetSessionID(userID); - try - { - InventoryCollection invCol = m_RemoteConnector.GetFolderContent(userID.ToString(), folderID, sessionID); - foreach (InventoryItemBase item in invCol.Items) - UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData); - return invCol; - } - catch (Exception e) - { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderContent operation failed, {0} {1}", - e.Source, e.Message); - } - InventoryCollection nullCollection = new InventoryCollection(); - nullCollection.Folders = new List(); - nullCollection.Items = new List(); - nullCollection.UserID = userID; - return nullCollection; - } - - public override List GetFolderItems(UUID userID, UUID folderID) - { - UUID sessionID = GetSessionID(userID); - return m_RemoteConnector.GetFolderItems(userID.ToString(), folderID, sessionID); - } - - public override bool AddFolder(InventoryFolderBase folder) - { - if (folder == null) - return false; - - UUID sessionID = GetSessionID(folder.Owner); - return m_RemoteConnector.AddFolder(folder.Owner.ToString(), folder, sessionID); - } - - public override bool UpdateFolder(InventoryFolderBase folder) - { - if (folder == null) - return false; - - UUID sessionID = GetSessionID(folder.Owner); - return m_RemoteConnector.UpdateFolder(folder.Owner.ToString(), folder, sessionID); - } - - public override bool MoveFolder(InventoryFolderBase folder) - { - if (folder == null) - return false; - - UUID sessionID = GetSessionID(folder.Owner); - return m_RemoteConnector.MoveFolder(folder.Owner.ToString(), folder, sessionID); - } - - public override bool DeleteFolders(UUID ownerID, List folderIDs) - { - if (folderIDs == null) - return false; - if (folderIDs.Count == 0) - return false; - - UUID sessionID = GetSessionID(ownerID); - return m_RemoteConnector.DeleteFolders(ownerID.ToString(), folderIDs, sessionID); - } - - - public override bool PurgeFolder(InventoryFolderBase folder) - { - if (folder == null) - return false; - - UUID sessionID = GetSessionID(folder.Owner); - return m_RemoteConnector.PurgeFolder(folder.Owner.ToString(), folder, sessionID); - } - - // public bool AddItem(InventoryItemBase item) inherited - // Uses AddItemPlain - - protected override bool AddItemPlain(InventoryItemBase item) - { - if (item == null) - return false; - - UUID sessionID = GetSessionID(item.Owner); - return m_RemoteConnector.AddItem(item.Owner.ToString(), item, sessionID); - } - - public override bool UpdateItem(InventoryItemBase item) - { - if (item == null) - return false; - - UUID sessionID = GetSessionID(item.Owner); - return m_RemoteConnector.UpdateItem(item.Owner.ToString(), item, sessionID); - } - - public override bool MoveItems(UUID ownerID, List items) - { - if (items == null) - return false; - - UUID sessionID = GetSessionID(ownerID); - return m_RemoteConnector.MoveItems(ownerID.ToString(), items, sessionID); - } - - - public override bool DeleteItems(UUID ownerID, List itemIDs) - { - if (itemIDs == null) - return false; - if (itemIDs.Count == 0) - return true; - - UUID sessionID = GetSessionID(ownerID); - return m_RemoteConnector.DeleteItems(ownerID.ToString(), itemIDs, sessionID); - } - - public override InventoryItemBase GetItem(InventoryItemBase item) - { - if (item == null) - return null; - - UUID sessionID = GetSessionID(item.Owner); - return m_RemoteConnector.QueryItem(item.Owner.ToString(), item, sessionID); - } - - public override InventoryFolderBase GetFolder(InventoryFolderBase folder) - { - if (folder == null) - return null; - - UUID sessionID = GetSessionID(folder.Owner); - return m_RemoteConnector.QueryFolder(folder.Owner.ToString(), folder, sessionID); - } - - public override bool HasInventoryForUser(UUID userID) - { - return false; - } - - public override List GetActiveGestures(UUID userId) - { - return new List(); - } - - public override int GetAssetPermissions(UUID userID, UUID assetID) - { - UUID sessionID = GetSessionID(userID); - return m_RemoteConnector.GetAssetPermissions(userID.ToString(), assetID, sessionID); - } - - - #endregion - - private UUID GetSessionID(UUID userID) - { - return UUID.Zero; - } - - } -} diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index c5972ddf1e..56720b7b7a 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 if (destination == null) return false; + // We limit the number of messages sent for a position change to just one per + // simulator so when we receive the update we need to hand it to each of the + // scenes; scenes each check to see if the is a scene presence for the avatar + // note that we really don't need the GridRegion for this call foreach (Scene s in m_sceneList) { - if (s.RegionInfo.RegionHandle == destination.RegionHandle) - { - //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); - s.IncomingChildAgentDataUpdate(cAgentData); - return true; - } + //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); + s.IncomingChildAgentDataUpdate(cAgentData); } //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate"); - return false; + return true; } public bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent) diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs new file mode 100644 index 0000000000..f6d1a826c7 --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs @@ -0,0 +1,224 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using System.Security; +using System.Text; +using log4net; +using Nini.Config; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Framework.Console; +using OpenSim.Region.CoreModules.Framework.InterfaceCommander; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Region.CoreModules.World.Estate +{ + /// + /// Estate management console commands. + /// + public class EstateManagementCommands + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + protected EstateManagementModule m_module; + + protected Commander m_commander = new Commander("estate"); + + public EstateManagementCommands(EstateManagementModule module) + { + m_module = module; + } + + public void Initialise() + { + m_log.DebugFormat("[ESTATE MODULE]: Setting up estate commands for region {0}", m_module.Scene.RegionInfo.RegionName); + + m_module.Scene.AddCommand(m_module, "set terrain texture", + "set terrain texture [] []", + "Sets the terrain to , if or are specified, it will only " + + "set it on regions with a matching coordinate. Specify -1 in or to wildcard" + + " that coordinate.", + consoleSetTerrainTexture); + + m_module.Scene.AddCommand(m_module, "set terrain heights", + "set terrain heights [] []", + "Sets the terrain texture heights on corner # to /, if or are specified, it will only " + + "set it on regions with a matching coordinate. Specify -1 in or to wildcard" + + " that coordinate. Corner # SW = 0, NW = 1, SE = 2, NE = 3.", + consoleSetTerrainHeights); + + Command showCommand + = new Command("show", CommandIntentions.COMMAND_STATISTICAL, ShowEstatesCommand, "Shows all estates on the simulator."); + + m_commander.RegisterCommand("show", showCommand); + + m_module.Scene.RegisterModuleCommander(m_commander); + + m_module.Scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole; + } + + public void Close() + { + m_module.Scene.EventManager.OnPluginConsole -= EventManagerOnPluginConsole; + m_module.Scene.UnregisterModuleCommander(m_commander.Name); + } + + /// + /// Processes commandline input. Do not call directly. + /// + /// Commandline arguments + protected void EventManagerOnPluginConsole(string[] args) + { + if (args[0] == "estate") + { + if (args.Length == 1) + { + m_commander.ProcessConsoleCommand("help", new string[0]); + return; + } + + string[] tmpArgs = new string[args.Length - 2]; + int i; + for (i = 2; i < args.Length; i++) + tmpArgs[i - 2] = args[i]; + + m_commander.ProcessConsoleCommand(args[1], tmpArgs); + } + } + + protected void consoleSetTerrainTexture(string module, string[] args) + { + string num = args[3]; + string uuid = args[4]; + int x = (args.Length > 5 ? int.Parse(args[5]) : -1); + int y = (args.Length > 6 ? int.Parse(args[6]) : -1); + + if (x == -1 || m_module.Scene.RegionInfo.RegionLocX == x) + { + if (y == -1 || m_module.Scene.RegionInfo.RegionLocY == y) + { + int corner = int.Parse(num); + UUID texture = UUID.Parse(uuid); + + m_log.Debug("[ESTATEMODULE]: Setting terrain textures for " + m_module.Scene.RegionInfo.RegionName + + string.Format(" (C#{0} = {1})", corner, texture)); + + switch (corner) + { + case 0: + m_module.Scene.RegionInfo.RegionSettings.TerrainTexture1 = texture; + break; + case 1: + m_module.Scene.RegionInfo.RegionSettings.TerrainTexture2 = texture; + break; + case 2: + m_module.Scene.RegionInfo.RegionSettings.TerrainTexture3 = texture; + break; + case 3: + m_module.Scene.RegionInfo.RegionSettings.TerrainTexture4 = texture; + break; + } + + m_module.Scene.RegionInfo.RegionSettings.Save(); + m_module.TriggerRegionInfoChange(); + m_module.sendRegionInfoPacketToAll(); + } + } + } + + protected void consoleSetTerrainHeights(string module, string[] args) + { + string num = args[3]; + string min = args[4]; + string max = args[5]; + int x = (args.Length > 6 ? int.Parse(args[6]) : -1); + int y = (args.Length > 7 ? int.Parse(args[7]) : -1); + + if (x == -1 || m_module.Scene.RegionInfo.RegionLocX == x) + { + if (y == -1 || m_module.Scene.RegionInfo.RegionLocY == y) + { + int corner = int.Parse(num); + float lowValue = float.Parse(min, Culture.NumberFormatInfo); + float highValue = float.Parse(max, Culture.NumberFormatInfo); + + m_log.Debug("[ESTATEMODULE]: Setting terrain heights " + m_module.Scene.RegionInfo.RegionName + + string.Format(" (C{0}, {1}-{2}", corner, lowValue, highValue)); + + switch (corner) + { + case 0: + m_module.Scene.RegionInfo.RegionSettings.Elevation1SW = lowValue; + m_module.Scene.RegionInfo.RegionSettings.Elevation2SW = highValue; + break; + case 1: + m_module.Scene.RegionInfo.RegionSettings.Elevation1NW = lowValue; + m_module.Scene.RegionInfo.RegionSettings.Elevation2NW = highValue; + break; + case 2: + m_module.Scene.RegionInfo.RegionSettings.Elevation1SE = lowValue; + m_module.Scene.RegionInfo.RegionSettings.Elevation2SE = highValue; + break; + case 3: + m_module.Scene.RegionInfo.RegionSettings.Elevation1NE = lowValue; + m_module.Scene.RegionInfo.RegionSettings.Elevation2NE = highValue; + break; + } + + m_module.Scene.RegionInfo.RegionSettings.Save(); + m_module.TriggerRegionInfoChange(); + m_module.sendRegionHandshakeToAll(); + } + } + } + + protected void ShowEstatesCommand(Object[] args) + { + StringBuilder report = new StringBuilder(); + RegionInfo ri = m_module.Scene.RegionInfo; + EstateSettings es = ri.EstateSettings; + + report.AppendFormat("Estate information for region {0}\n", ri.RegionName); + report.AppendFormat( + "{0,-20} {1,-7} {2,-20}\n", + "Estate Name", + "ID", + "Owner"); + + report.AppendFormat( + "{0,-20} {1,-7} {2,-20}\n", + es.EstateName, es.EstateID, m_module.UserManager.GetUserName(es.EstateOwner)); + + MainConsole.Instance.Output(report.ToString()); + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 01f04d93d3..57ab13550a 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -24,12 +24,14 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + using System; using System.Collections.Generic; using System.IO; using System.Reflection; using System.Security; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -38,13 +40,17 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.World.Estate { - public class EstateManagementModule : IEstateModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "EstateManagementModule")] + public class EstateManagementModule : IEstateModule, INonSharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private delegate void LookupUUIDS(List uuidLst); - private Scene m_scene; + public Scene Scene { get; private set; } + public IUserManagement UserManager { get; private set; } + + protected EstateManagementCommands m_commands; private EstateTerrainXferHandler TerrainUploader; @@ -58,89 +64,89 @@ namespace OpenSim.Region.CoreModules.World.Estate { uint sun = 0; - if (!m_scene.RegionInfo.EstateSettings.UseGlobalTime) - sun=(uint)(m_scene.RegionInfo.EstateSettings.SunPosition*1024.0) + 0x1800; + if (!Scene.RegionInfo.EstateSettings.UseGlobalTime) + sun = (uint)(Scene.RegionInfo.EstateSettings.SunPosition * 1024.0) + 0x1800; UUID estateOwner; - estateOwner = m_scene.RegionInfo.EstateSettings.EstateOwner; + estateOwner = Scene.RegionInfo.EstateSettings.EstateOwner; - if (m_scene.Permissions.IsGod(remote_client.AgentId)) + if (Scene.Permissions.IsGod(remote_client.AgentId)) estateOwner = remote_client.AgentId; remote_client.SendDetailedEstateData(invoice, - m_scene.RegionInfo.EstateSettings.EstateName, - m_scene.RegionInfo.EstateSettings.EstateID, - m_scene.RegionInfo.EstateSettings.ParentEstateID, + Scene.RegionInfo.EstateSettings.EstateName, + Scene.RegionInfo.EstateSettings.EstateID, + Scene.RegionInfo.EstateSettings.ParentEstateID, GetEstateFlags(), sun, - m_scene.RegionInfo.RegionSettings.Covenant, - m_scene.RegionInfo.EstateSettings.AbuseEmail, + Scene.RegionInfo.RegionSettings.Covenant, + Scene.RegionInfo.EstateSettings.AbuseEmail, estateOwner); remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, - m_scene.RegionInfo.EstateSettings.EstateManagers, - m_scene.RegionInfo.EstateSettings.EstateID); + Scene.RegionInfo.EstateSettings.EstateManagers, + Scene.RegionInfo.EstateSettings.EstateID); remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, - m_scene.RegionInfo.EstateSettings.EstateAccess, - m_scene.RegionInfo.EstateSettings.EstateID); + Scene.RegionInfo.EstateSettings.EstateAccess, + Scene.RegionInfo.EstateSettings.EstateID); remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, - m_scene.RegionInfo.EstateSettings.EstateGroups, - m_scene.RegionInfo.EstateSettings.EstateID); + Scene.RegionInfo.EstateSettings.EstateGroups, + Scene.RegionInfo.EstateSettings.EstateID); remote_client.SendBannedUserList(invoice, - m_scene.RegionInfo.EstateSettings.EstateBans, - m_scene.RegionInfo.EstateSettings.EstateID); + Scene.RegionInfo.EstateSettings.EstateBans, + Scene.RegionInfo.EstateSettings.EstateID); } private void estateSetRegionInfoHandler(bool blockTerraform, bool noFly, bool allowDamage, bool blockLandResell, int maxAgents, float objectBonusFactor, int matureLevel, bool restrictPushObject, bool allowParcelChanges) { if (blockTerraform) - m_scene.RegionInfo.RegionSettings.BlockTerraform = true; + Scene.RegionInfo.RegionSettings.BlockTerraform = true; else - m_scene.RegionInfo.RegionSettings.BlockTerraform = false; + Scene.RegionInfo.RegionSettings.BlockTerraform = false; if (noFly) - m_scene.RegionInfo.RegionSettings.BlockFly = true; + Scene.RegionInfo.RegionSettings.BlockFly = true; else - m_scene.RegionInfo.RegionSettings.BlockFly = false; + Scene.RegionInfo.RegionSettings.BlockFly = false; if (allowDamage) - m_scene.RegionInfo.RegionSettings.AllowDamage = true; + Scene.RegionInfo.RegionSettings.AllowDamage = true; else - m_scene.RegionInfo.RegionSettings.AllowDamage = false; + Scene.RegionInfo.RegionSettings.AllowDamage = false; if (blockLandResell) - m_scene.RegionInfo.RegionSettings.AllowLandResell = false; + Scene.RegionInfo.RegionSettings.AllowLandResell = false; else - m_scene.RegionInfo.RegionSettings.AllowLandResell = true; + Scene.RegionInfo.RegionSettings.AllowLandResell = true; - m_scene.RegionInfo.RegionSettings.AgentLimit = (byte) maxAgents; + Scene.RegionInfo.RegionSettings.AgentLimit = (byte) maxAgents; - m_scene.RegionInfo.RegionSettings.ObjectBonus = objectBonusFactor; + Scene.RegionInfo.RegionSettings.ObjectBonus = objectBonusFactor; if (matureLevel <= 13) - m_scene.RegionInfo.RegionSettings.Maturity = 0; + Scene.RegionInfo.RegionSettings.Maturity = 0; else if (matureLevel <= 21) - m_scene.RegionInfo.RegionSettings.Maturity = 1; + Scene.RegionInfo.RegionSettings.Maturity = 1; else - m_scene.RegionInfo.RegionSettings.Maturity = 2; + Scene.RegionInfo.RegionSettings.Maturity = 2; if (restrictPushObject) - m_scene.RegionInfo.RegionSettings.RestrictPushing = true; + Scene.RegionInfo.RegionSettings.RestrictPushing = true; else - m_scene.RegionInfo.RegionSettings.RestrictPushing = false; + Scene.RegionInfo.RegionSettings.RestrictPushing = false; if (allowParcelChanges) - m_scene.RegionInfo.RegionSettings.AllowLandJoinDivide = true; + Scene.RegionInfo.RegionSettings.AllowLandJoinDivide = true; else - m_scene.RegionInfo.RegionSettings.AllowLandJoinDivide = false; + Scene.RegionInfo.RegionSettings.AllowLandJoinDivide = false; - m_scene.RegionInfo.RegionSettings.Save(); + Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); sendRegionInfoPacketToAll(); @@ -154,19 +160,19 @@ namespace OpenSim.Region.CoreModules.World.Estate switch (corner) { case 0: - m_scene.RegionInfo.RegionSettings.TerrainTexture1 = texture; + Scene.RegionInfo.RegionSettings.TerrainTexture1 = texture; break; case 1: - m_scene.RegionInfo.RegionSettings.TerrainTexture2 = texture; + Scene.RegionInfo.RegionSettings.TerrainTexture2 = texture; break; case 2: - m_scene.RegionInfo.RegionSettings.TerrainTexture3 = texture; + Scene.RegionInfo.RegionSettings.TerrainTexture3 = texture; break; case 3: - m_scene.RegionInfo.RegionSettings.TerrainTexture4 = texture; + Scene.RegionInfo.RegionSettings.TerrainTexture4 = texture; break; } - m_scene.RegionInfo.RegionSettings.Save(); + Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); sendRegionInfoPacketToAll(); } @@ -176,23 +182,23 @@ namespace OpenSim.Region.CoreModules.World.Estate switch (corner) { case 0: - m_scene.RegionInfo.RegionSettings.Elevation1SW = lowValue; - m_scene.RegionInfo.RegionSettings.Elevation2SW = highValue; + Scene.RegionInfo.RegionSettings.Elevation1SW = lowValue; + Scene.RegionInfo.RegionSettings.Elevation2SW = highValue; break; case 1: - m_scene.RegionInfo.RegionSettings.Elevation1NW = lowValue; - m_scene.RegionInfo.RegionSettings.Elevation2NW = highValue; + Scene.RegionInfo.RegionSettings.Elevation1NW = lowValue; + Scene.RegionInfo.RegionSettings.Elevation2NW = highValue; break; case 2: - m_scene.RegionInfo.RegionSettings.Elevation1SE = lowValue; - m_scene.RegionInfo.RegionSettings.Elevation2SE = highValue; + Scene.RegionInfo.RegionSettings.Elevation1SE = lowValue; + Scene.RegionInfo.RegionSettings.Elevation2SE = highValue; break; case 3: - m_scene.RegionInfo.RegionSettings.Elevation1NE = lowValue; - m_scene.RegionInfo.RegionSettings.Elevation2NE = highValue; + Scene.RegionInfo.RegionSettings.Elevation1NE = lowValue; + Scene.RegionInfo.RegionSettings.Elevation2NE = highValue; break; } - m_scene.RegionInfo.RegionSettings.Save(); + Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); sendRegionInfoPacketToAll(); } @@ -208,30 +214,30 @@ namespace OpenSim.Region.CoreModules.World.Estate bool UseGlobal, bool EstateFixedSun, float EstateSunHour) { // Water Height - m_scene.RegionInfo.RegionSettings.WaterHeight = WaterHeight; + Scene.RegionInfo.RegionSettings.WaterHeight = WaterHeight; // Terraforming limits - m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit = TerrainRaiseLimit; - m_scene.RegionInfo.RegionSettings.TerrainLowerLimit = TerrainLowerLimit; + Scene.RegionInfo.RegionSettings.TerrainRaiseLimit = TerrainRaiseLimit; + Scene.RegionInfo.RegionSettings.TerrainLowerLimit = TerrainLowerLimit; // Time of day / fixed sun - m_scene.RegionInfo.RegionSettings.UseEstateSun = UseEstateSun; - m_scene.RegionInfo.RegionSettings.FixedSun = UseFixedSun; - m_scene.RegionInfo.RegionSettings.SunPosition = SunHour; + Scene.RegionInfo.RegionSettings.UseEstateSun = UseEstateSun; + Scene.RegionInfo.RegionSettings.FixedSun = UseFixedSun; + Scene.RegionInfo.RegionSettings.SunPosition = SunHour; - m_scene.TriggerEstateSunUpdate(); + Scene.TriggerEstateSunUpdate(); //m_log.Debug("[ESTATE]: UFS: " + UseFixedSun.ToString()); //m_log.Debug("[ESTATE]: SunHour: " + SunHour.ToString()); sendRegionInfoPacketToAll(); - m_scene.RegionInfo.RegionSettings.Save(); + Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); } private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds) { - IRestartModule restartModule = m_scene.RequestModuleInterface(); + IRestartModule restartModule = Scene.RequestModuleInterface(); if (restartModule != null) { List times = new List(); @@ -252,8 +258,8 @@ namespace OpenSim.Region.CoreModules.World.Estate private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, UUID estateCovenantID) { - m_scene.RegionInfo.RegionSettings.Covenant = estateCovenantID; - m_scene.RegionInfo.RegionSettings.Save(); + Scene.RegionInfo.RegionSettings.Covenant = estateCovenantID; + Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); } @@ -261,17 +267,17 @@ namespace OpenSim.Region.CoreModules.World.Estate { // EstateAccessDelta handles Estate Managers, Sim Access, Sim Banlist, allowed Groups.. etc. - if (user == m_scene.RegionInfo.EstateSettings.EstateOwner) + if (user == Scene.RegionInfo.EstateSettings.EstateOwner) return; // never process EO if ((estateAccessType & 4) != 0) // User add { - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) { - m_scene.RegionInfo.EstateSettings.AddEstateUser(user); - m_scene.RegionInfo.EstateSettings.Save(); + Scene.RegionInfo.EstateSettings.AddEstateUser(user); + Scene.RegionInfo.EstateSettings.Save(); TriggerEstateInfoChange(); - remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID); + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID); } else { @@ -281,13 +287,13 @@ namespace OpenSim.Region.CoreModules.World.Estate } if ((estateAccessType & 8) != 0) // User remove { - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) { - m_scene.RegionInfo.EstateSettings.RemoveEstateUser(user); - m_scene.RegionInfo.EstateSettings.Save(); + Scene.RegionInfo.EstateSettings.RemoveEstateUser(user); + Scene.RegionInfo.EstateSettings.Save(); TriggerEstateInfoChange(); - remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID); + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID); } else { @@ -296,12 +302,12 @@ namespace OpenSim.Region.CoreModules.World.Estate } if ((estateAccessType & 16) != 0) // Group add { - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) { - m_scene.RegionInfo.EstateSettings.AddEstateGroup(user); - m_scene.RegionInfo.EstateSettings.Save(); + Scene.RegionInfo.EstateSettings.AddEstateGroup(user); + Scene.RegionInfo.EstateSettings.Save(); TriggerEstateInfoChange(); - remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateGroups, m_scene.RegionInfo.EstateSettings.EstateID); + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID); } else { @@ -310,13 +316,13 @@ namespace OpenSim.Region.CoreModules.World.Estate } if ((estateAccessType & 32) != 0) // Group remove { - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) { - m_scene.RegionInfo.EstateSettings.RemoveEstateGroup(user); - m_scene.RegionInfo.EstateSettings.Save(); + Scene.RegionInfo.EstateSettings.RemoveEstateGroup(user); + Scene.RegionInfo.EstateSettings.Save(); TriggerEstateInfoChange(); - remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateGroups, m_scene.RegionInfo.EstateSettings.EstateID); + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID); } else { @@ -325,9 +331,9 @@ namespace OpenSim.Region.CoreModules.World.Estate } if ((estateAccessType & 64) != 0) // Ban add { - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) + if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || Scene.Permissions.BypassPermissions()) { - EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; + EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans; bool alreadyInList = false; @@ -346,20 +352,20 @@ namespace OpenSim.Region.CoreModules.World.Estate EstateBan item = new EstateBan(); item.BannedUserID = user; - item.EstateID = m_scene.RegionInfo.EstateSettings.EstateID; + item.EstateID = Scene.RegionInfo.EstateSettings.EstateID; item.BannedHostAddress = "0.0.0.0"; item.BannedHostIPMask = "0.0.0.0"; - m_scene.RegionInfo.EstateSettings.AddBan(item); - m_scene.RegionInfo.EstateSettings.Save(); + Scene.RegionInfo.EstateSettings.AddBan(item); + Scene.RegionInfo.EstateSettings.Save(); TriggerEstateInfoChange(); - ScenePresence s = m_scene.GetScenePresence(user); + ScenePresence s = Scene.GetScenePresence(user); if (s != null) { if (!s.IsChildAgent) { - m_scene.TeleportClientHome(user, s.ControllingClient); + Scene.TeleportClientHome(user, s.ControllingClient); } } @@ -369,7 +375,7 @@ namespace OpenSim.Region.CoreModules.World.Estate remote_client.SendAlertMessage("User is already on the region ban list"); } //m_scene.RegionInfo.regionBanlist.Add(Manager(user); - remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID); + remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); } else { @@ -378,9 +384,9 @@ namespace OpenSim.Region.CoreModules.World.Estate } if ((estateAccessType & 128) != 0) // Ban remove { - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) + if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || Scene.Permissions.BypassPermissions()) { - EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; + EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans; bool alreadyInList = false; EstateBan listitem = null; @@ -393,20 +399,21 @@ namespace OpenSim.Region.CoreModules.World.Estate listitem = banlistcheck[i]; break; } - } + if (alreadyInList && listitem != null) { - m_scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID); - m_scene.RegionInfo.EstateSettings.Save(); + Scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID); + Scene.RegionInfo.EstateSettings.Save(); TriggerEstateInfoChange(); } else { remote_client.SendAlertMessage("User is not on the region ban list"); } + //m_scene.RegionInfo.regionBanlist.Add(Manager(user); - remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID); + remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); } else { @@ -415,12 +422,12 @@ namespace OpenSim.Region.CoreModules.World.Estate } if ((estateAccessType & 256) != 0) // Manager add { - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) { - m_scene.RegionInfo.EstateSettings.AddEstateManager(user); - m_scene.RegionInfo.EstateSettings.Save(); + Scene.RegionInfo.EstateSettings.AddEstateManager(user); + Scene.RegionInfo.EstateSettings.Save(); TriggerEstateInfoChange(); - remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID); + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID); } else { @@ -429,13 +436,13 @@ namespace OpenSim.Region.CoreModules.World.Estate } if ((estateAccessType & 512) != 0) // Manager remove { - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) { - m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user); - m_scene.RegionInfo.EstateSettings.Save(); + Scene.RegionInfo.EstateSettings.RemoveEstateManager(user); + Scene.RegionInfo.EstateSettings.Save(); TriggerEstateInfoChange(); - remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID); + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID); } else { @@ -447,7 +454,7 @@ namespace OpenSim.Region.CoreModules.World.Estate private void SendSimulatorBlueBoxMessage( IClientAPI remote_client, UUID invoice, UUID senderID, UUID sessionID, string senderName, string message) { - IDialogModule dm = m_scene.RequestModuleInterface(); + IDialogModule dm = Scene.RequestModuleInterface(); if (dm != null) dm.SendNotificationToUsersInRegion(senderID, senderName, message); @@ -462,61 +469,62 @@ namespace OpenSim.Region.CoreModules.World.Estate private void handleEstateDebugRegionRequest(IClientAPI remote_client, UUID invoice, UUID senderID, bool scripted, bool collisionEvents, bool physics) { if (physics) - m_scene.RegionInfo.RegionSettings.DisablePhysics = true; + Scene.RegionInfo.RegionSettings.DisablePhysics = true; else - m_scene.RegionInfo.RegionSettings.DisablePhysics = false; + Scene.RegionInfo.RegionSettings.DisablePhysics = false; if (scripted) - m_scene.RegionInfo.RegionSettings.DisableScripts = true; + Scene.RegionInfo.RegionSettings.DisableScripts = true; else - m_scene.RegionInfo.RegionSettings.DisableScripts = false; + Scene.RegionInfo.RegionSettings.DisableScripts = false; if (collisionEvents) - m_scene.RegionInfo.RegionSettings.DisableCollisions = true; + Scene.RegionInfo.RegionSettings.DisableCollisions = true; else - m_scene.RegionInfo.RegionSettings.DisableCollisions = false; + Scene.RegionInfo.RegionSettings.DisableCollisions = false; - m_scene.RegionInfo.RegionSettings.Save(); + Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); - m_scene.SetSceneCoreDebug(scripted, collisionEvents, physics); + Scene.SetSceneCoreDebug(scripted, collisionEvents, physics); } private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID, UUID prey) { - if (!m_scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false)) + if (!Scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false)) return; if (prey != UUID.Zero) { - ScenePresence s = m_scene.GetScenePresence(prey); + ScenePresence s = Scene.GetScenePresence(prey); if (s != null) { - m_scene.TeleportClientHome(prey, s.ControllingClient); + Scene.TeleportClientHome(prey, s.ControllingClient); } } } private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID) { - if (!m_scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false)) + if (!Scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false)) return; - m_scene.ForEachScenePresence(delegate(ScenePresence sp) + Scene.ForEachScenePresence(delegate(ScenePresence sp) { if (sp.UUID != senderID) { - ScenePresence p = m_scene.GetScenePresence(sp.UUID); + ScenePresence p = Scene.GetScenePresence(sp.UUID); // make sure they are still there, we could be working down a long list // Also make sure they are actually in the region if (p != null && !p.IsChildAgent) { - m_scene.TeleportClientHome(p.UUID, p.ControllingClient); + Scene.TeleportClientHome(p.UUID, p.ControllingClient); } } }); } + private void AbortTerrainXferHandler(IClientAPI remoteClient, ulong XferID) { if (TerrainUploader != null) @@ -547,11 +555,11 @@ namespace OpenSim.Region.CoreModules.World.Estate TerrainUploader = null; } remoteClient.SendAlertMessage("Terrain Upload Complete. Loading...."); - ITerrainModule terr = m_scene.RequestModuleInterface(); + ITerrainModule terr = Scene.RequestModuleInterface(); if (terr != null) { - m_log.Warn("[CLIENT]: Got Request to Send Terrain in region " + m_scene.RegionInfo.RegionName); + m_log.Warn("[CLIENT]: Got Request to Send Terrain in region " + Scene.RegionInfo.RegionName); try { @@ -597,7 +605,6 @@ namespace OpenSim.Region.CoreModules.World.Estate private void handleUploadTerrain(IClientAPI remote_client, string clientFileName) { - if (TerrainUploader == null) { @@ -615,16 +622,16 @@ namespace OpenSim.Region.CoreModules.World.Estate { remote_client.SendAlertMessage("Another Terrain Upload is in progress. Please wait your turn!"); } - } + private void handleTerrainRequest(IClientAPI remote_client, string clientFileName) { // Save terrain here - ITerrainModule terr = m_scene.RequestModuleInterface(); + ITerrainModule terr = Scene.RequestModuleInterface(); if (terr != null) { - m_log.Warn("[CLIENT]: Got Request to Send Terrain in region " + m_scene.RegionInfo.RegionName); + m_log.Warn("[CLIENT]: Got Request to Send Terrain in region " + Scene.RegionInfo.RegionName); if (File.Exists(Util.dataDir() + "/terrain.raw")) { File.Delete(Util.dataDir() + "/terrain.raw"); @@ -635,7 +642,7 @@ namespace OpenSim.Region.CoreModules.World.Estate byte[] bdata = new byte[input.Length]; input.Read(bdata, 0, (int)input.Length); remote_client.SendAlertMessage("Terrain file written, starting download..."); - m_scene.XferManager.AddNewFile("terrain.raw", bdata); + Scene.XferManager.AddNewFile("terrain.raw", bdata); // Tell client about it m_log.Warn("[CLIENT]: Sending Terrain to " + remote_client.Name); remote_client.SendInitiateDownload("terrain.raw", clientFileName); @@ -645,35 +652,35 @@ namespace OpenSim.Region.CoreModules.World.Estate private void HandleRegionInfoRequest(IClientAPI remote_client) { RegionInfoForEstateMenuArgs args = new RegionInfoForEstateMenuArgs(); - args.billableFactor = m_scene.RegionInfo.EstateSettings.BillableFactor; - args.estateID = m_scene.RegionInfo.EstateSettings.EstateID; - args.maxAgents = (byte)m_scene.RegionInfo.RegionSettings.AgentLimit; - args.objectBonusFactor = (float)m_scene.RegionInfo.RegionSettings.ObjectBonus; - args.parentEstateID = m_scene.RegionInfo.EstateSettings.ParentEstateID; - args.pricePerMeter = m_scene.RegionInfo.EstateSettings.PricePerMeter; - args.redirectGridX = m_scene.RegionInfo.EstateSettings.RedirectGridX; - args.redirectGridY = m_scene.RegionInfo.EstateSettings.RedirectGridY; + args.billableFactor = Scene.RegionInfo.EstateSettings.BillableFactor; + args.estateID = Scene.RegionInfo.EstateSettings.EstateID; + args.maxAgents = (byte)Scene.RegionInfo.RegionSettings.AgentLimit; + args.objectBonusFactor = (float)Scene.RegionInfo.RegionSettings.ObjectBonus; + args.parentEstateID = Scene.RegionInfo.EstateSettings.ParentEstateID; + args.pricePerMeter = Scene.RegionInfo.EstateSettings.PricePerMeter; + args.redirectGridX = Scene.RegionInfo.EstateSettings.RedirectGridX; + args.redirectGridY = Scene.RegionInfo.EstateSettings.RedirectGridY; args.regionFlags = GetRegionFlags(); - args.simAccess = m_scene.RegionInfo.AccessLevel; - args.sunHour = (float)m_scene.RegionInfo.RegionSettings.SunPosition; - args.terrainLowerLimit = (float)m_scene.RegionInfo.RegionSettings.TerrainLowerLimit; - args.terrainRaiseLimit = (float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit; - args.useEstateSun = m_scene.RegionInfo.RegionSettings.UseEstateSun; - args.waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; - args.simName = m_scene.RegionInfo.RegionName; - args.regionType = m_scene.RegionInfo.RegionType; + args.simAccess = Scene.RegionInfo.AccessLevel; + args.sunHour = (float)Scene.RegionInfo.RegionSettings.SunPosition; + args.terrainLowerLimit = (float)Scene.RegionInfo.RegionSettings.TerrainLowerLimit; + args.terrainRaiseLimit = (float)Scene.RegionInfo.RegionSettings.TerrainRaiseLimit; + args.useEstateSun = Scene.RegionInfo.RegionSettings.UseEstateSun; + args.waterHeight = (float)Scene.RegionInfo.RegionSettings.WaterHeight; + args.simName = Scene.RegionInfo.RegionName; + args.regionType = Scene.RegionInfo.RegionType; remote_client.SendRegionInfoToEstateMenu(args); } private void HandleEstateCovenantRequest(IClientAPI remote_client) { - remote_client.SendEstateCovenantInformation(m_scene.RegionInfo.RegionSettings.Covenant); + remote_client.SendEstateCovenantInformation(Scene.RegionInfo.RegionSettings.Covenant); } private void HandleLandStatRequest(int parcelID, uint reportType, uint requestFlags, string filter, IClientAPI remoteClient) { - if (!m_scene.Permissions.CanIssueEstateCommand(remoteClient.AgentId, false)) + if (!Scene.Permissions.CanIssueEstateCommand(remoteClient.AgentId, false)) return; Dictionary SceneData = new Dictionary(); @@ -681,11 +688,11 @@ namespace OpenSim.Region.CoreModules.World.Estate if (reportType == 1) { - SceneData = m_scene.PhysicsScene.GetTopColliders(); + SceneData = Scene.PhysicsScene.GetTopColliders(); } else if (reportType == 0) { - SceneData = m_scene.SceneGraph.GetTopScripts(); + SceneData = Scene.SceneGraph.GetTopScripts(); } List SceneReport = new List(); @@ -693,7 +700,7 @@ namespace OpenSim.Region.CoreModules.World.Estate { foreach (uint obj in SceneData.Keys) { - SceneObjectPart prt = m_scene.GetSceneObjectPart(obj); + SceneObjectPart prt = Scene.GetSceneObjectPart(obj); if (prt != null) { if (prt.ParentGroup != null) @@ -765,7 +772,7 @@ namespace OpenSim.Region.CoreModules.World.Estate { // string lookupname = m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]); - IUserManagement userManager = m_scene.RequestModuleInterface(); + IUserManagement userManager = Scene.RequestModuleInterface(); if (userManager != null) userManager.GetUserName(uuidarr[i]); @@ -780,7 +787,7 @@ namespace OpenSim.Region.CoreModules.World.Estate public void sendRegionInfoPacketToAll() { - m_scene.ForEachScenePresence(delegate(ScenePresence sp) + Scene.ForEachScenePresence(delegate(ScenePresence sp) { if (!sp.IsChildAgent) HandleRegionInfoRequest(sp.ControllingClient); @@ -791,99 +798,99 @@ namespace OpenSim.Region.CoreModules.World.Estate { RegionHandshakeArgs args = new RegionHandshakeArgs(); - args.isEstateManager = m_scene.RegionInfo.EstateSettings.IsEstateManager(remoteClient.AgentId); - if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero && m_scene.RegionInfo.EstateSettings.EstateOwner == remoteClient.AgentId) + args.isEstateManager = Scene.RegionInfo.EstateSettings.IsEstateManager(remoteClient.AgentId); + if (Scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero && Scene.RegionInfo.EstateSettings.EstateOwner == remoteClient.AgentId) args.isEstateManager = true; - args.billableFactor = m_scene.RegionInfo.EstateSettings.BillableFactor; - args.terrainStartHeight0 = (float)m_scene.RegionInfo.RegionSettings.Elevation1SW; - args.terrainHeightRange0 = (float)m_scene.RegionInfo.RegionSettings.Elevation2SW; - args.terrainStartHeight1 = (float)m_scene.RegionInfo.RegionSettings.Elevation1NW; - args.terrainHeightRange1 = (float)m_scene.RegionInfo.RegionSettings.Elevation2NW; - args.terrainStartHeight2 = (float)m_scene.RegionInfo.RegionSettings.Elevation1SE; - args.terrainHeightRange2 = (float)m_scene.RegionInfo.RegionSettings.Elevation2SE; - args.terrainStartHeight3 = (float)m_scene.RegionInfo.RegionSettings.Elevation1NE; - args.terrainHeightRange3 = (float)m_scene.RegionInfo.RegionSettings.Elevation2NE; - args.simAccess = m_scene.RegionInfo.AccessLevel; - args.waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; + args.billableFactor = Scene.RegionInfo.EstateSettings.BillableFactor; + args.terrainStartHeight0 = (float)Scene.RegionInfo.RegionSettings.Elevation1SW; + args.terrainHeightRange0 = (float)Scene.RegionInfo.RegionSettings.Elevation2SW; + args.terrainStartHeight1 = (float)Scene.RegionInfo.RegionSettings.Elevation1NW; + args.terrainHeightRange1 = (float)Scene.RegionInfo.RegionSettings.Elevation2NW; + args.terrainStartHeight2 = (float)Scene.RegionInfo.RegionSettings.Elevation1SE; + args.terrainHeightRange2 = (float)Scene.RegionInfo.RegionSettings.Elevation2SE; + args.terrainStartHeight3 = (float)Scene.RegionInfo.RegionSettings.Elevation1NE; + args.terrainHeightRange3 = (float)Scene.RegionInfo.RegionSettings.Elevation2NE; + args.simAccess = Scene.RegionInfo.AccessLevel; + args.waterHeight = (float)Scene.RegionInfo.RegionSettings.WaterHeight; args.regionFlags = GetRegionFlags(); - args.regionName = m_scene.RegionInfo.RegionName; - args.SimOwner = m_scene.RegionInfo.EstateSettings.EstateOwner; + args.regionName = Scene.RegionInfo.RegionName; + args.SimOwner = Scene.RegionInfo.EstateSettings.EstateOwner; args.terrainBase0 = UUID.Zero; args.terrainBase1 = UUID.Zero; args.terrainBase2 = UUID.Zero; args.terrainBase3 = UUID.Zero; - args.terrainDetail0 = m_scene.RegionInfo.RegionSettings.TerrainTexture1; - args.terrainDetail1 = m_scene.RegionInfo.RegionSettings.TerrainTexture2; - args.terrainDetail2 = m_scene.RegionInfo.RegionSettings.TerrainTexture3; - args.terrainDetail3 = m_scene.RegionInfo.RegionSettings.TerrainTexture4; + args.terrainDetail0 = Scene.RegionInfo.RegionSettings.TerrainTexture1; + args.terrainDetail1 = Scene.RegionInfo.RegionSettings.TerrainTexture2; + args.terrainDetail2 = Scene.RegionInfo.RegionSettings.TerrainTexture3; + args.terrainDetail3 = Scene.RegionInfo.RegionSettings.TerrainTexture4; - remoteClient.SendRegionHandshake(m_scene.RegionInfo,args); + remoteClient.SendRegionHandshake(Scene.RegionInfo,args); } public void sendRegionHandshakeToAll() { - m_scene.ForEachClient(sendRegionHandshake); + Scene.ForEachClient(sendRegionHandshake); } public void handleEstateChangeInfo(IClientAPI remoteClient, UUID invoice, UUID senderID, UInt32 parms1, UInt32 parms2) { if (parms2 == 0) { - m_scene.RegionInfo.EstateSettings.UseGlobalTime = true; - m_scene.RegionInfo.EstateSettings.SunPosition = 0.0; + Scene.RegionInfo.EstateSettings.UseGlobalTime = true; + Scene.RegionInfo.EstateSettings.SunPosition = 0.0; } else { - m_scene.RegionInfo.EstateSettings.UseGlobalTime = false; - m_scene.RegionInfo.EstateSettings.SunPosition = (parms2 - 0x1800)/1024.0; + Scene.RegionInfo.EstateSettings.UseGlobalTime = false; + Scene.RegionInfo.EstateSettings.SunPosition = (parms2 - 0x1800)/1024.0; } if ((parms1 & 0x00000010) != 0) - m_scene.RegionInfo.EstateSettings.FixedSun = true; + Scene.RegionInfo.EstateSettings.FixedSun = true; else - m_scene.RegionInfo.EstateSettings.FixedSun = false; + Scene.RegionInfo.EstateSettings.FixedSun = false; if ((parms1 & 0x00008000) != 0) - m_scene.RegionInfo.EstateSettings.PublicAccess = true; + Scene.RegionInfo.EstateSettings.PublicAccess = true; else - m_scene.RegionInfo.EstateSettings.PublicAccess = false; + Scene.RegionInfo.EstateSettings.PublicAccess = false; if ((parms1 & 0x10000000) != 0) - m_scene.RegionInfo.EstateSettings.AllowVoice = true; + Scene.RegionInfo.EstateSettings.AllowVoice = true; else - m_scene.RegionInfo.EstateSettings.AllowVoice = false; + Scene.RegionInfo.EstateSettings.AllowVoice = false; if ((parms1 & 0x00100000) != 0) - m_scene.RegionInfo.EstateSettings.AllowDirectTeleport = true; + Scene.RegionInfo.EstateSettings.AllowDirectTeleport = true; else - m_scene.RegionInfo.EstateSettings.AllowDirectTeleport = false; + Scene.RegionInfo.EstateSettings.AllowDirectTeleport = false; if ((parms1 & 0x00800000) != 0) - m_scene.RegionInfo.EstateSettings.DenyAnonymous = true; + Scene.RegionInfo.EstateSettings.DenyAnonymous = true; else - m_scene.RegionInfo.EstateSettings.DenyAnonymous = false; + Scene.RegionInfo.EstateSettings.DenyAnonymous = false; if ((parms1 & 0x01000000) != 0) - m_scene.RegionInfo.EstateSettings.DenyIdentified = true; + Scene.RegionInfo.EstateSettings.DenyIdentified = true; else - m_scene.RegionInfo.EstateSettings.DenyIdentified = false; + Scene.RegionInfo.EstateSettings.DenyIdentified = false; if ((parms1 & 0x02000000) != 0) - m_scene.RegionInfo.EstateSettings.DenyTransacted = true; + Scene.RegionInfo.EstateSettings.DenyTransacted = true; else - m_scene.RegionInfo.EstateSettings.DenyTransacted = false; + Scene.RegionInfo.EstateSettings.DenyTransacted = false; if ((parms1 & 0x40000000) != 0) - m_scene.RegionInfo.EstateSettings.DenyMinors = true; + Scene.RegionInfo.EstateSettings.DenyMinors = true; else - m_scene.RegionInfo.EstateSettings.DenyMinors = false; + Scene.RegionInfo.EstateSettings.DenyMinors = false; - m_scene.RegionInfo.EstateSettings.Save(); + Scene.RegionInfo.EstateSettings.Save(); TriggerEstateInfoChange(); - m_scene.TriggerEstateSunUpdate(); + Scene.TriggerEstateSunUpdate(); sendDetailedEstateData(remoteClient, invoice); } @@ -891,137 +898,38 @@ namespace OpenSim.Region.CoreModules.World.Estate #endregion #region IRegionModule Members + + public string Name { get { return "EstateManagementModule"; } } + + public Type ReplaceableInterface { get { return null; } } - public void Initialise(Scene scene, IConfigSource source) + public void Initialise(IConfigSource source) {} + + public void AddRegion(Scene scene) { - m_scene = scene; - m_scene.RegisterModuleInterface(this); - m_scene.EventManager.OnNewClient += EventManager_OnNewClient; - m_scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; - - m_scene.AddCommand(this, "set terrain texture", - "set terrain texture [] []", - "Sets the terrain to , if or are specified, it will only " + - "set it on regions with a matching coordinate. Specify -1 in or to wildcard" + - " that coordinate.", - consoleSetTerrainTexture); - - m_scene.AddCommand(this, "set terrain heights", - "set terrain heights [] []", - "Sets the terrain texture heights on corner # to /, if or are specified, it will only " + - "set it on regions with a matching coordinate. Specify -1 in or to wildcard" + - " that coordinate. Corner # SW = 0, NW = 1, SE = 2, NE = 3.", - consoleSetTerrainHeights); + Scene = scene; + Scene.RegisterModuleInterface(this); + Scene.EventManager.OnNewClient += EventManager_OnNewClient; + Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; + + m_commands = new EstateManagementCommands(this); + m_commands.Initialise(); } - - #region Console Commands - - public void consoleSetTerrainTexture(string module, string[] args) - { - string num = args[3]; - string uuid = args[4]; - int x = (args.Length > 5 ? int.Parse(args[5]) : -1); - int y = (args.Length > 6 ? int.Parse(args[6]) : -1); - - if (x == -1 || m_scene.RegionInfo.RegionLocX == x) - { - if (y == -1 || m_scene.RegionInfo.RegionLocY == y) - { - int corner = int.Parse(num); - UUID texture = UUID.Parse(uuid); - - m_log.Debug("[ESTATEMODULE] Setting terrain textures for " + m_scene.RegionInfo.RegionName + - string.Format(" (C#{0} = {1})", corner, texture)); - - switch (corner) - { - case 0: - m_scene.RegionInfo.RegionSettings.TerrainTexture1 = texture; - break; - case 1: - m_scene.RegionInfo.RegionSettings.TerrainTexture2 = texture; - break; - case 2: - m_scene.RegionInfo.RegionSettings.TerrainTexture3 = texture; - break; - case 3: - m_scene.RegionInfo.RegionSettings.TerrainTexture4 = texture; - break; - } - m_scene.RegionInfo.RegionSettings.Save(); - TriggerRegionInfoChange(); - sendRegionInfoPacketToAll(); - - } - } - } - - public void consoleSetTerrainHeights(string module, string[] args) - { - string num = args[3]; - string min = args[4]; - string max = args[5]; - int x = (args.Length > 6 ? int.Parse(args[6]) : -1); - int y = (args.Length > 7 ? int.Parse(args[7]) : -1); - - if (x == -1 || m_scene.RegionInfo.RegionLocX == x) - { - if (y == -1 || m_scene.RegionInfo.RegionLocY == y) - { - int corner = int.Parse(num); - float lowValue = float.Parse(min, Culture.NumberFormatInfo); - float highValue = float.Parse(max, Culture.NumberFormatInfo); - - m_log.Debug("[ESTATEMODULE] Setting terrain heights " + m_scene.RegionInfo.RegionName + - string.Format(" (C{0}, {1}-{2}", corner, lowValue, highValue)); - - switch (corner) - { - case 0: - m_scene.RegionInfo.RegionSettings.Elevation1SW = lowValue; - m_scene.RegionInfo.RegionSettings.Elevation2SW = highValue; - break; - case 1: - m_scene.RegionInfo.RegionSettings.Elevation1NW = lowValue; - m_scene.RegionInfo.RegionSettings.Elevation2NW = highValue; - break; - case 2: - m_scene.RegionInfo.RegionSettings.Elevation1SE = lowValue; - m_scene.RegionInfo.RegionSettings.Elevation2SE = highValue; - break; - case 3: - m_scene.RegionInfo.RegionSettings.Elevation1NE = lowValue; - m_scene.RegionInfo.RegionSettings.Elevation2NE = highValue; - break; - } - m_scene.RegionInfo.RegionSettings.Save(); - TriggerRegionInfoChange(); - sendRegionHandshakeToAll(); - } - } - } - - #endregion - - public void PostInitialise() + + public void RemoveRegion(Scene scene) {} + + public void RegionLoaded(Scene scene) { // Sets up the sun module based no the saved Estate and Region Settings // DO NOT REMOVE or the sun will stop working - m_scene.TriggerEstateSunUpdate(); + scene.TriggerEstateSunUpdate(); + + UserManager = scene.RequestModuleInterface(); } - public void Close() + public void Close() { - } - - public string Name - { - get { return "EstateManagementModule"; } - } - - public bool IsSharedModule - { - get { return false; } + m_commands.Close(); } #endregion @@ -1031,14 +939,14 @@ namespace OpenSim.Region.CoreModules.World.Estate public void changeWaterHeight(float height) { setRegionTerrainSettings(height, - (float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit, - (float)m_scene.RegionInfo.RegionSettings.TerrainLowerLimit, - m_scene.RegionInfo.RegionSettings.UseEstateSun, - m_scene.RegionInfo.RegionSettings.FixedSun, - (float)m_scene.RegionInfo.RegionSettings.SunPosition, - m_scene.RegionInfo.EstateSettings.UseGlobalTime, - m_scene.RegionInfo.EstateSettings.FixedSun, - (float)m_scene.RegionInfo.EstateSettings.SunPosition); + (float)Scene.RegionInfo.RegionSettings.TerrainRaiseLimit, + (float)Scene.RegionInfo.RegionSettings.TerrainLowerLimit, + Scene.RegionInfo.RegionSettings.UseEstateSun, + Scene.RegionInfo.RegionSettings.FixedSun, + (float)Scene.RegionInfo.RegionSettings.SunPosition, + Scene.RegionInfo.EstateSettings.UseGlobalTime, + Scene.RegionInfo.EstateSettings.FixedSun, + (float)Scene.RegionInfo.EstateSettings.SunPosition); sendRegionInfoPacketToAll(); } @@ -1078,32 +986,32 @@ namespace OpenSim.Region.CoreModules.World.Estate // Fully implemented // - if (m_scene.RegionInfo.RegionSettings.AllowDamage) + if (Scene.RegionInfo.RegionSettings.AllowDamage) flags |= RegionFlags.AllowDamage; - if (m_scene.RegionInfo.RegionSettings.BlockTerraform) + if (Scene.RegionInfo.RegionSettings.BlockTerraform) flags |= RegionFlags.BlockTerraform; - if (!m_scene.RegionInfo.RegionSettings.AllowLandResell) + if (!Scene.RegionInfo.RegionSettings.AllowLandResell) flags |= RegionFlags.BlockLandResell; - if (m_scene.RegionInfo.RegionSettings.DisableCollisions) + if (Scene.RegionInfo.RegionSettings.DisableCollisions) flags |= RegionFlags.SkipCollisions; - if (m_scene.RegionInfo.RegionSettings.DisableScripts) + if (Scene.RegionInfo.RegionSettings.DisableScripts) flags |= RegionFlags.SkipScripts; - if (m_scene.RegionInfo.RegionSettings.DisablePhysics) + if (Scene.RegionInfo.RegionSettings.DisablePhysics) flags |= RegionFlags.SkipPhysics; - if (m_scene.RegionInfo.RegionSettings.BlockFly) + if (Scene.RegionInfo.RegionSettings.BlockFly) flags |= RegionFlags.NoFly; - if (m_scene.RegionInfo.RegionSettings.RestrictPushing) + if (Scene.RegionInfo.RegionSettings.RestrictPushing) flags |= RegionFlags.RestrictPushObject; - if (m_scene.RegionInfo.RegionSettings.AllowLandJoinDivide) + if (Scene.RegionInfo.RegionSettings.AllowLandJoinDivide) flags |= RegionFlags.AllowParcelChanges; - if (m_scene.RegionInfo.RegionSettings.BlockShowInSearch) + if (Scene.RegionInfo.RegionSettings.BlockShowInSearch) flags |= RegionFlags.BlockParcelSearch; - if (m_scene.RegionInfo.RegionSettings.FixedSun) + if (Scene.RegionInfo.RegionSettings.FixedSun) flags |= RegionFlags.SunFixed; - if (m_scene.RegionInfo.RegionSettings.Sandbox) + if (Scene.RegionInfo.RegionSettings.Sandbox) flags |= RegionFlags.Sandbox; - if (m_scene.RegionInfo.EstateSettings.AllowVoice) + if (Scene.RegionInfo.EstateSettings.AllowVoice) flags |= RegionFlags.AllowVoice; // Fudge these to always on, so the menu options activate @@ -1125,32 +1033,32 @@ namespace OpenSim.Region.CoreModules.World.Estate { RegionFlags flags = RegionFlags.None; - if (m_scene.RegionInfo.EstateSettings.FixedSun) + if (Scene.RegionInfo.EstateSettings.FixedSun) flags |= RegionFlags.SunFixed; - if (m_scene.RegionInfo.EstateSettings.PublicAccess) + if (Scene.RegionInfo.EstateSettings.PublicAccess) flags |= (RegionFlags.PublicAllowed | RegionFlags.ExternallyVisible); - if (m_scene.RegionInfo.EstateSettings.AllowVoice) + if (Scene.RegionInfo.EstateSettings.AllowVoice) flags |= RegionFlags.AllowVoice; - if (m_scene.RegionInfo.EstateSettings.AllowDirectTeleport) + if (Scene.RegionInfo.EstateSettings.AllowDirectTeleport) flags |= RegionFlags.AllowDirectTeleport; - if (m_scene.RegionInfo.EstateSettings.DenyAnonymous) + if (Scene.RegionInfo.EstateSettings.DenyAnonymous) flags |= RegionFlags.DenyAnonymous; - if (m_scene.RegionInfo.EstateSettings.DenyIdentified) + if (Scene.RegionInfo.EstateSettings.DenyIdentified) flags |= RegionFlags.DenyIdentified; - if (m_scene.RegionInfo.EstateSettings.DenyTransacted) + if (Scene.RegionInfo.EstateSettings.DenyTransacted) flags |= RegionFlags.DenyTransacted; - if (m_scene.RegionInfo.EstateSettings.AbuseEmailToEstateOwner) + if (Scene.RegionInfo.EstateSettings.AbuseEmailToEstateOwner) flags |= RegionFlags.AbuseEmailToEstateOwner; - if (m_scene.RegionInfo.EstateSettings.BlockDwell) + if (Scene.RegionInfo.EstateSettings.BlockDwell) flags |= RegionFlags.BlockDwell; - if (m_scene.RegionInfo.EstateSettings.EstateSkipScripts) + if (Scene.RegionInfo.EstateSettings.EstateSkipScripts) flags |= RegionFlags.EstateSkipScripts; - if (m_scene.RegionInfo.EstateSettings.ResetHomeOnTeleport) + if (Scene.RegionInfo.EstateSettings.ResetHomeOnTeleport) flags |= RegionFlags.ResetHomeOnTeleport; - if (m_scene.RegionInfo.EstateSettings.TaxFree) + if (Scene.RegionInfo.EstateSettings.TaxFree) flags |= RegionFlags.TaxFree; - if (m_scene.RegionInfo.EstateSettings.DenyMinors) + if (Scene.RegionInfo.EstateSettings.DenyMinors) flags |= (RegionFlags)(1 << 30); return (uint)flags; @@ -1158,38 +1066,38 @@ namespace OpenSim.Region.CoreModules.World.Estate public bool IsManager(UUID avatarID) { - if (avatarID == m_scene.RegionInfo.EstateSettings.EstateOwner) + if (avatarID == Scene.RegionInfo.EstateSettings.EstateOwner) return true; - List ems = new List(m_scene.RegionInfo.EstateSettings.EstateManagers); + List ems = new List(Scene.RegionInfo.EstateSettings.EstateManagers); if (ems.Contains(avatarID)) return true; return false; } - protected void TriggerRegionInfoChange() + public void TriggerRegionInfoChange() { ChangeDelegate change = OnRegionInfoChange; if (change != null) - change(m_scene.RegionInfo.RegionID); + change(Scene.RegionInfo.RegionID); } - protected void TriggerEstateInfoChange() + public void TriggerEstateInfoChange() { ChangeDelegate change = OnEstateInfoChange; if (change != null) - change(m_scene.RegionInfo.RegionID); + change(Scene.RegionInfo.RegionID); } - protected void TriggerEstateMessage(UUID fromID, string fromName, string message) + public void TriggerEstateMessage(UUID fromID, string fromName, string message) { MessageDelegate onmessage = OnEstateMessage; if (onmessage != null) - onmessage(m_scene.RegionInfo.RegionID, fromID, fromName, message); + onmessage(Scene.RegionInfo.RegionID, fromID, fromName, message); } } } diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index e0f36a2081..10949701d9 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -764,10 +764,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap if (!responseMap.ContainsKey(itemtype.ToString())) // remote sim doesnt have the stated region handle { - if (!m_blacklistedregions.ContainsKey(regionhandle)) + m_log.DebugFormat("[WORLD MAP]: Remote sim does not have the stated region. Blacklisting."); + lock (m_blacklistedregions) { - m_log.DebugFormat("[WORLD MAP]: Remote sim does not have the stated region. Blacklisting."); - m_blacklistedregions.Add(regionhandle, Environment.TickCount); + if (!m_blacklistedregions.ContainsKey(regionhandle)) + m_blacklistedregions.Add(regionhandle, Environment.TickCount); } } diff --git a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs index c850f7fd81..721f0eedea 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs @@ -32,7 +32,7 @@ namespace OpenSim.Region.Framework.Interfaces public delegate void ChangeDelegate(UUID regionID); public delegate void MessageDelegate(UUID regionID, UUID fromID, string fromName, string message); - public interface IEstateModule : IRegionModule + public interface IEstateModule { event ChangeDelegate OnRegionInfoChange; event ChangeDelegate OnEstateInfoChange; diff --git a/OpenSim/Region/Framework/Interfaces/ISceneViewer.cs b/OpenSim/Region/Framework/Interfaces/ISceneViewer.cs index 7251d57f69..2397f223b3 100644 --- a/OpenSim/Region/Framework/Interfaces/ISceneViewer.cs +++ b/OpenSim/Region/Framework/Interfaces/ISceneViewer.cs @@ -36,5 +36,6 @@ namespace OpenSim.Region.Framework.Interfaces void Close(); void QueuePartForUpdate(SceneObjectPart part); void SendPrimUpdates(); + int GetPendingObjectsCount(); } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index cf6428c8a6..ec3870818d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -64,6 +64,8 @@ namespace OpenSim.Region.Framework.Scenes #region Fields + public bool EmergencyMonitoring = false; + public SynchronizeSceneHandler SynchronizeScene; public SimStatsReporter StatsReporter; public List NorthBorders = new List(); diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index f8ff308893..837e65523e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -193,7 +193,8 @@ namespace OpenSim.Region.Framework.Scenes } } - public delegate void SendChildAgentDataUpdateDelegate(AgentPosition cAgentData, UUID scopeID, ulong regionHandle); + public delegate void SendChildAgentDataUpdateDelegate(AgentPosition cAgentData, UUID scopeID, GridRegion dest); + /// /// This informs all neighboring regions about the settings of it's child agent. @@ -202,31 +203,17 @@ namespace OpenSim.Region.Framework.Scenes /// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc. /// /// - private void SendChildAgentDataUpdateAsync(AgentPosition cAgentData, UUID scopeID, ulong regionHandle) + private void SendChildAgentDataUpdateAsync(AgentPosition cAgentData, UUID scopeID, GridRegion dest) { //m_log.Info("[INTERGRID]: Informing neighbors about my agent in " + m_regionInfo.RegionName); try { - //m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData); - uint x = 0, y = 0; - Utils.LongToUInts(regionHandle, out x, out y); - GridRegion destination = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); - m_scene.SimulationService.UpdateAgent(destination, cAgentData); + m_scene.SimulationService.UpdateAgent(dest, cAgentData); } catch { // Ignore; we did our best } - - //if (regionAccepted) - //{ - // //m_log.Info("[INTERGRID]: Completed sending a neighbor an update about my agent"); - //} - //else - //{ - // //m_log.Info("[INTERGRID]: Failed sending a neighbor an update about my agent"); - //} - } private void SendChildAgentDataUpdateCompleted(IAsyncResult iar) @@ -240,14 +227,28 @@ namespace OpenSim.Region.Framework.Scenes // This assumes that we know what our neighbors are. try { + uint x = 0, y = 0; + List simulatorList = new List(); foreach (ulong regionHandle in presence.KnownChildRegionHandles) { if (regionHandle != m_regionInfo.RegionHandle) { - SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync; - d.BeginInvoke(cAgentData, m_regionInfo.ScopeID, regionHandle, - SendChildAgentDataUpdateCompleted, - d); + // we only want to send one update to each simulator; the simulator will + // hand it off to the regions where a child agent exists, this does assume + // that the region position is cached or performance will degrade + Utils.LongToUInts(regionHandle, out x, out y); + GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); + if (! simulatorList.Contains(dest.ServerURI)) + { + // we havent seen this simulator before, add it to the list + // and send it an update + simulatorList.Add(dest.ServerURI); + + SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync; + d.BeginInvoke(cAgentData, m_regionInfo.ScopeID, dest, + SendChildAgentDataUpdateCompleted, + d); + } } } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 153fee1154..6471a54510 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2060,8 +2060,9 @@ namespace OpenSim.Region.Framework.Scenes public void GetProperties(IClientAPI client) { + //Viewer wants date in microseconds so multiply it by 1,000,000. client.SendObjectPropertiesReply( - m_fromUserInventoryItemID, (ulong)_creationDate, _creatorID, UUID.Zero, UUID.Zero, + m_fromUserInventoryItemID, (ulong)_creationDate*(ulong)1e6, _creatorID, UUID.Zero, UUID.Zero, _groupID, (short)InventorySerial, _lastOwnerID, UUID, _ownerID, ParentGroup.RootPart.TouchName, new byte[0], ParentGroup.RootPart.SitName, Name, Description, ParentGroup.RootPart._ownerMask, ParentGroup.RootPart._nextOwnerMask, ParentGroup.RootPart._groupMask, ParentGroup.RootPart._everyoneMask, @@ -2103,7 +2104,7 @@ namespace OpenSim.Region.Framework.Scenes { Quaternion newRot; - if (this.LinkNum == 0) + if (this.LinkNum == 0 || this.LinkNum == 1) { newRot = RotationOffset; } diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs index b44a0100a4..7c067ca148 100644 --- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs +++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs @@ -205,6 +205,14 @@ namespace OpenSim.Region.Framework.Scenes Reset(); } + public int GetPendingObjectsCount() + { + if (m_pendingObjects != null) + return m_pendingObjects.Count; + + return 0; + } + public class ScenePartUpdate { public UUID FullID; diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs index 87d067c961..dfeecb1bbc 100644 --- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs @@ -95,7 +95,15 @@ namespace OpenSim.Region.CoreModules.UDP.Linden "Show throttle settings for each client and for the server overall", "Without the 'full' option, only root agents are shown." + " With the 'full' option child agents are also shown.", - ShowThrottlesReport); + ShowThrottlesReport); + + scene.AddCommand( + this, "emergency-monitoring", + "Go on/off emergency monitoring mode", + "Go on/off emergency monitoring mode", + "Go on/off emergency monitoring mode", + EmergencyMonitoring); + } public void RemoveRegion(Scene scene) @@ -120,7 +128,25 @@ namespace OpenSim.Region.CoreModules.UDP.Linden { MainConsole.Instance.Output(GetThrottlesReport(cmd)); } - + + protected void EmergencyMonitoring(string module, string[] cmd) + { + bool mode = true; + if (cmd.Length == 1 || (cmd.Length > 1 && cmd[1] == "on")) + { + mode = true; + MainConsole.Instance.Output("Emergency Monitoring ON"); + } + else + { + mode = false; + MainConsole.Instance.Output("Emergency Monitoring OFF"); + } + + foreach (Scene s in m_scenes.Values) + s.EmergencyMonitoring = mode; + } + protected string GetColumnEntry(string entry, int maxLength, int columnPadding) { return string.Format( @@ -154,24 +180,26 @@ namespace OpenSim.Region.CoreModules.UDP.Linden report.Append(GetColumnEntry("Type", maxTypeLength, columnPadding)); report.AppendFormat( - "{0,7} {1,7} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}\n", + "{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", "Pkts", "Pkts", + "Pkts", "Bytes", - "Pkts", - "Pkts", - "Pkts", - "Pkts", - "Pkts", - "Pkts", - "Pkts", - "Pkts"); + "Q Pkts", + "Q Pkts", + "Q Pkts", + "Q Pkts", + "Q Pkts", + "Q Pkts", + "Q Pkts", + "Q Pkts"); report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", ""); report.AppendFormat( - "{0,7} {1,7} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}\n", - "Out", + "{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", "In", + "Out", + "Resent", "Unacked", "Resend", "Land", @@ -333,7 +361,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden ThrottleRates throttleRates = udpServer.ThrottleRates; report.AppendFormat( "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}", - "n/a", + (throttleRates.Total * 8) / 1000, (throttleRates.ResendLimit * 8) / 1000, (throttleRates.LandLimit * 8) / 1000, (throttleRates.WindLimit * 8) / 1000, diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs index 5c779debc5..6d2607541e 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 void SetAgentActiveGroupRole(UUID RequestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID); void SetAgentGroupInfo(UUID RequestingAgentID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile); + /// + /// Get information about a specific group to which the user belongs. + /// + /// The agent requesting the information. + /// The agent requested. + /// The group requested. + /// + /// If the user is a member of the group then the data structure is returned. If not, then null is returned. + /// GroupMembershipData GetAgentGroupMembership(UUID RequestingAgentID, UUID AgentID, UUID GroupID); + + /// + /// Get information about the groups to which a user belongs. + /// + /// The agent requesting the information. + /// The agent requested. + /// + /// Information about the groups to which the user belongs. If the user belongs to no groups then an empty + /// list is returned. + /// List GetAgentGroupMemberships(UUID RequestingAgentID, UUID AgentID); 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 0d265f2501..81725c55c7 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 } } - return findings; } @@ -712,54 +711,55 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups { if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); - GroupMembershipData data = new GroupMembershipData(); - - /////////////////////////////// - // Agent Specific Information: - // - OSDMap UserActiveGroup; - if (SimianGetGenericEntry(agentID, "Group", "ActiveGroup", out UserActiveGroup)) - { - data.Active = UserActiveGroup["GroupID"].AsUUID().Equals(groupID); - } + GroupMembershipData data = null; + bool foundData = false; OSDMap UserGroupMemberInfo; if (SimianGetGenericEntry(agentID, "GroupMember", groupID.ToString(), out UserGroupMemberInfo)) { + data = new GroupMembershipData(); data.AcceptNotices = UserGroupMemberInfo["AcceptNotices"].AsBoolean(); data.Contribution = UserGroupMemberInfo["Contribution"].AsInteger(); data.ListInProfile = UserGroupMemberInfo["ListInProfile"].AsBoolean(); - data.ActiveRole = UserGroupMemberInfo["SelectedRoleID"].AsUUID(); + data.ActiveRole = UserGroupMemberInfo["SelectedRoleID"].AsUUID(); + + /////////////////////////////// + // Agent Specific Information: + // + OSDMap UserActiveGroup; + if (SimianGetGenericEntry(agentID, "Group", "ActiveGroup", out UserActiveGroup)) + { + data.Active = UserActiveGroup["GroupID"].AsUUID().Equals(groupID); + } /////////////////////////////// // Role Specific Information: // - OSDMap GroupRoleInfo; if (SimianGetGenericEntry(groupID, "GroupRole", data.ActiveRole.ToString(), out GroupRoleInfo)) { data.GroupTitle = GroupRoleInfo["Title"].AsString(); data.GroupPowers = GroupRoleInfo["Powers"].AsULong(); - } - } - - /////////////////////////////// - // Group Specific Information: - // - OSDMap GroupInfo; - string GroupName; - if (SimianGetFirstGenericEntry(groupID, "Group", out GroupName, out GroupInfo)) - { - data.GroupID = groupID; - data.AllowPublish = GroupInfo["AllowPublish"].AsBoolean(); - data.Charter = GroupInfo["Charter"].AsString(); - data.FounderID = GroupInfo["FounderID"].AsUUID(); - data.GroupName = GroupName; - data.GroupPicture = GroupInfo["InsigniaID"].AsUUID(); - data.MaturePublish = GroupInfo["MaturePublish"].AsBoolean(); - data.MembershipFee = GroupInfo["MembershipFee"].AsInteger(); - data.OpenEnrollment = GroupInfo["OpenEnrollment"].AsBoolean(); - data.ShowInList = GroupInfo["ShowInList"].AsBoolean(); + } + + /////////////////////////////// + // Group Specific Information: + // + OSDMap GroupInfo; + string GroupName; + if (SimianGetFirstGenericEntry(groupID, "Group", out GroupName, out GroupInfo)) + { + data.GroupID = groupID; + data.AllowPublish = GroupInfo["AllowPublish"].AsBoolean(); + data.Charter = GroupInfo["Charter"].AsString(); + data.FounderID = GroupInfo["FounderID"].AsUUID(); + data.GroupName = GroupName; + data.GroupPicture = GroupInfo["InsigniaID"].AsUUID(); + data.MaturePublish = GroupInfo["MaturePublish"].AsBoolean(); + data.MembershipFee = GroupInfo["MembershipFee"].AsInteger(); + data.OpenEnrollment = GroupInfo["OpenEnrollment"].AsBoolean(); + data.ShowInList = GroupInfo["ShowInList"].AsBoolean(); + } } return data; diff --git a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs index d4b7020542..cee8851c3a 100644 --- a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs +++ b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs @@ -71,6 +71,9 @@ namespace OpenSim.Region.OptionalModules.World.WorldView public void RegionLoaded(Scene scene) { + if (!m_Enabled) + return; + m_Generator = scene.RequestModuleInterface(); if (m_Generator == null) { diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index f713cfa5f4..092ac253af 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1781,15 +1781,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected void SetTexture(SceneObjectPart part, string texture, int face) { - UUID textureID=new UUID(); + UUID textureID = new UUID(); - if (!UUID.TryParse(texture, out textureID)) - { - textureID=InventoryKey(texture, (int)AssetType.Texture); - } - - if (textureID == UUID.Zero) - return; + textureID = InventoryKey(texture, (int)AssetType.Texture); + if (textureID == UUID.Zero) + { + if (!UUID.TryParse(texture, out textureID)) + return; + } Primitive.TextureEntry tex = part.Shape.Textures; @@ -3147,14 +3146,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api msg.fromGroup = false;// fromGroup; msg.offline = (byte)0; //offline; msg.ParentEstateID = 0; //ParentEstateID; - msg.Position = Vector3.Zero;// new Vector3(m_host.AbsolutePosition); + msg.Position = new Vector3(m_host.AbsolutePosition); msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid; - msg.binaryBucket = new byte[0];// binaryBucket; + msg.binaryBucket + = Util.StringToBytes256( + "{0}/{1}/{2}/{3}", + World.RegionInfo.RegionName, + (int)Math.Floor(m_host.AbsolutePosition.X), + (int)Math.Floor(m_host.AbsolutePosition.Y), + (int)Math.Floor(m_host.AbsolutePosition.Z)); if (m_TransferModule != null) { m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); } + ScriptSleep(2000); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index c0c790dd28..688dfe4649 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -702,7 +702,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // and convert the regionName to the target region if (regionName.Contains(".") && regionName.Contains(":")) { -// List regions = World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1); + // Even though we use none of the results, we need to perform this call because it appears + // to have some the side effect of setting up hypergrid teleport locations. + World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1); +// List regions = World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1); + string[] parts = regionName.Split(new char[] { ':' }); if (parts.Length > 2) regionName = parts[0] + ':' + parts[1] + "/ " + parts[2]; diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 2601d2ac5a..6a23deefb2 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -110,7 +110,7 @@ namespace OpenSim.Server.Handlers.Simulation DoAgentDelete(request, responsedata, agentID, action, regionID); return responsedata; } - else if (method.Equals("QUERYACCESSS")) + else if (method.Equals("QUERYACCESS")) { DoQueryAccess(request, responsedata, agentID, regionID); return responsedata; @@ -200,6 +200,11 @@ namespace OpenSim.Server.Handlers.Simulation // We're behind a proxy Hashtable headers = (Hashtable)request["headers"]; + + //// DEBUG + //foreach (object o in headers.Keys) + // m_log.DebugFormat("XXX {0} = {1}", o.ToString(), (headers[o] == null? "null" : headers[o].ToString())); + string xff = "X-Forwarded-For"; if (headers.ContainsKey(xff.ToLower())) xff = xff.ToLower(); diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs index 3fd2fcf4d6..a81af4355a 100644 --- a/OpenSim/Services/AssetService/AssetService.cs +++ b/OpenSim/Services/AssetService/AssetService.cs @@ -93,7 +93,7 @@ namespace OpenSim.Services.AssetService if (!UUID.TryParse(id, out assetID)) { - m_log.WarnFormat("[ASSET SERVICE]: Could not parse requested sset id {0}", id); + m_log.WarnFormat("[ASSET SERVICE]: Could not parse requested asset id {0}", id); return null; } diff --git a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs deleted file mode 100644 index 9878855355..0000000000 --- a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs +++ /dev/null @@ -1,335 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using log4net; -using Nini.Config; -using System; -using System.Collections.Generic; -using System.Reflection; -using OpenSim.Framework; -using OpenSim.Services.Interfaces; -using OpenMetaverse; - -namespace OpenSim.Services.Connectors.Inventory -{ - public class HGInventoryServiceConnector : ISessionAuthInventoryService - { - private static readonly ILog m_log = - LogManager.GetLogger( - MethodBase.GetCurrentMethod().DeclaringType); - - private Dictionary m_connectors = new Dictionary(); - - public HGInventoryServiceConnector(IConfigSource source) - { - IConfig moduleConfig = source.Configs["Modules"]; - if (moduleConfig != null) - { - - IConfig inventoryConfig = source.Configs["InventoryService"]; - if (inventoryConfig == null) - { - m_log.Error("[HG INVENTORY SERVICE]: InventoryService missing from OpenSim.ini"); - return; - } - - m_log.Info("[HG INVENTORY SERVICE]: HG inventory service enabled"); - } - } - - private bool StringToUrlAndUserID(string id, out string url, out string userID) - { - url = String.Empty; - userID = String.Empty; - - Uri assetUri; - - if (Uri.TryCreate(id, UriKind.Absolute, out assetUri) && - assetUri.Scheme == Uri.UriSchemeHttp) - { - url = "http://" + assetUri.Authority; - userID = assetUri.LocalPath.Trim(new char[] { '/' }); - return true; - } - - return false; - } - private ISessionAuthInventoryService GetConnector(string url) - { - InventoryServicesConnector connector = null; - lock (m_connectors) - { - if (m_connectors.ContainsKey(url)) - { - connector = m_connectors[url]; - } - else - { - // We're instantiating this class explicitly, but this won't - // work in general, because the remote grid may be running - // an inventory server that has a different protocol. - // Eventually we will want a piece of protocol asking - // the remote server about its kind. Definitely cool thing to do! - connector = new InventoryServicesConnector(url); - m_connectors.Add(url, connector); - } - } - return connector; - } - - public string Host - { - get { return string.Empty; } - } - - public void GetUserInventory(string id, UUID sessionID, InventoryReceiptCallback callback) - { - m_log.Debug("[HGInventory]: GetUserInventory " + id); - string url = string.Empty; - string userID = string.Empty; - - if (StringToUrlAndUserID(id, out url, out userID)) - { - ISessionAuthInventoryService connector = GetConnector(url); - connector.GetUserInventory(userID, sessionID, callback); - } - - } - - /// - /// Gets the user folder for the given folder-type - /// - /// - /// - /// - public Dictionary GetSystemFolders(string id, UUID sessionID) - { - m_log.Debug("[HGInventory]: GetSystemFolders " + id); - string url = string.Empty; - string userID = string.Empty; - - if (StringToUrlAndUserID(id, out url, out userID)) - { - ISessionAuthInventoryService connector = GetConnector(url); - return connector.GetSystemFolders(userID, sessionID); - } - - return new Dictionary(); - } - - /// - /// Gets everything (folders and items) inside a folder - /// - /// - /// - /// - public InventoryCollection GetFolderContent(string id, UUID folderID, UUID sessionID) - { - m_log.Debug("[HGInventory]: GetFolderContent " + id); - string url = string.Empty; - string userID = string.Empty; - - if (StringToUrlAndUserID(id, out url, out userID)) - { - ISessionAuthInventoryService connector = GetConnector(url); - return connector.GetFolderContent(userID, folderID, sessionID); - } - - return null; - } - - public bool AddFolder(string id, InventoryFolderBase folder, UUID sessionID) - { - string url = string.Empty; - string userID = string.Empty; - - if (StringToUrlAndUserID(id, out url, out userID)) - { - ISessionAuthInventoryService connector = GetConnector(url); - return connector.AddFolder(userID, folder, sessionID); - } - return false; - } - - public bool UpdateFolder(string id, InventoryFolderBase folder, UUID sessionID) - { - string url = string.Empty; - string userID = string.Empty; - - if (StringToUrlAndUserID(id, out url, out userID)) - { - ISessionAuthInventoryService connector = GetConnector(url); - return connector.UpdateFolder(userID, folder, sessionID); - } - return false; - } - - public bool MoveFolder(string id, InventoryFolderBase folder, UUID sessionID) - { - string url = string.Empty; - string userID = string.Empty; - - if (StringToUrlAndUserID(id, out url, out userID)) - { - ISessionAuthInventoryService connector = GetConnector(url); - return connector.MoveFolder(userID, folder, sessionID); - } - return false; - } - - public bool DeleteFolders(string id, List folders, UUID sessionID) - { - string url = string.Empty; - string userID = string.Empty; - - if (StringToUrlAndUserID(id, out url, out userID)) - { - ISessionAuthInventoryService connector = GetConnector(url); - return connector.DeleteFolders(userID, folders, sessionID); - } - return false; - } - - public bool PurgeFolder(string id, InventoryFolderBase folder, UUID sessionID) - { - string url = string.Empty; - string userID = string.Empty; - - if (StringToUrlAndUserID(id, out url, out userID)) - { - ISessionAuthInventoryService connector = GetConnector(url); - return connector.PurgeFolder(userID, folder, sessionID); - } - return false; - } - - public List GetFolderItems(string id, UUID folderID, UUID sessionID) - { - string url = string.Empty; - string userID = string.Empty; - - if (StringToUrlAndUserID(id, out url, out userID)) - { - ISessionAuthInventoryService connector = GetConnector(url); - return connector.GetFolderItems(userID, folderID, sessionID); - } - return new List(); - } - - public bool AddItem(string id, InventoryItemBase item, UUID sessionID) - { - string url = string.Empty; - string userID = string.Empty; - - if (StringToUrlAndUserID(id, out url, out userID)) - { - ISessionAuthInventoryService connector = GetConnector(url); - return connector.AddItem(userID, item, sessionID); - } - return false; - } - - public bool UpdateItem(string id, InventoryItemBase item, UUID sessionID) - { - string url = string.Empty; - string userID = string.Empty; - - if (StringToUrlAndUserID(id, out url, out userID)) - { - ISessionAuthInventoryService connector = GetConnector(url); - return connector.UpdateItem(userID, item, sessionID); - } - return false; - } - - public bool MoveItems(string id, List items, UUID sessionID) - { - string url = string.Empty; - string userID = string.Empty; - - if (StringToUrlAndUserID(id, out url, out userID)) - { - ISessionAuthInventoryService connector = GetConnector(url); - return connector.MoveItems(userID, items, sessionID); - } - return false; - } - - public bool DeleteItems(string id, List itemIDs, UUID sessionID) - { - string url = string.Empty; - string userID = string.Empty; - - if (StringToUrlAndUserID(id, out url, out userID)) - { - ISessionAuthInventoryService connector = GetConnector(url); - return connector.DeleteItems(userID, itemIDs, sessionID); - } - return false; - } - - public InventoryItemBase QueryItem(string id, InventoryItemBase item, UUID sessionID) - { - string url = string.Empty; - string userID = string.Empty; - - if (StringToUrlAndUserID(id, out url, out userID)) - { - //m_log.DebugFormat("[HGInventory CONNECTOR]: calling {0}", url); - ISessionAuthInventoryService connector = GetConnector(url); - return connector.QueryItem(userID, item, sessionID); - } - return null; - } - - public InventoryFolderBase QueryFolder(string id, InventoryFolderBase folder, UUID sessionID) - { - string url = string.Empty; - string userID = string.Empty; - - if (StringToUrlAndUserID(id, out url, out userID)) - { - ISessionAuthInventoryService connector = GetConnector(url); - return connector.QueryFolder(userID, folder, sessionID); - } - return null; - } - - public int GetAssetPermissions(string id, UUID assetID, UUID sessionID) - { - string url = string.Empty; - string userID = string.Empty; - - if (StringToUrlAndUserID(id, out url, out userID)) - { - ISessionAuthInventoryService connector = GetConnector(url); - return connector.GetAssetPermissions(userID, assetID, sessionID); - } - return 0; - } - } -} diff --git a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs deleted file mode 100644 index da8c7e2e61..0000000000 --- a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Collections.Generic; -using OpenSim.Framework; -using OpenSim.Services.Interfaces; -using OpenMetaverse; - -namespace OpenSim.Services.Connectors -{ - /// - /// Defines all operations to access a remote inventory service - /// using session authentication as a form of security. - /// - public interface ISessionAuthInventoryService - { - string Host - { - get; - } - - /// - /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the - /// inventory has been received - /// - /// - /// - void GetUserInventory(string userID, UUID session_id, InventoryReceiptCallback callback); - - /// - /// Gets the user folder for the given folder-type - /// - /// - /// - /// - Dictionary GetSystemFolders(string userID, UUID session_id); - - /// - /// Gets everything (folders and items) inside a folder - /// - /// - /// - /// - InventoryCollection GetFolderContent(string userID, UUID folderID, UUID session_id); - - /// - /// Add a new folder to the user's inventory - /// - /// - /// true if the folder was successfully added - bool AddFolder(string userID, InventoryFolderBase folder, UUID session_id); - - /// - /// Update a folder in the user's inventory - /// - /// - /// true if the folder was successfully updated - bool UpdateFolder(string userID, InventoryFolderBase folder, UUID session_id); - - /// - /// Move an inventory folder to a new location - /// - /// A folder containing the details of the new location - /// true if the folder was successfully moved - bool MoveFolder(string userID, InventoryFolderBase folder, UUID session_id); - - /// - /// Delete a list of inventory folders (from trash) - /// - bool DeleteFolders(string userID, List folders, UUID session_id); - - /// - /// Purge an inventory folder of all its items and subfolders. - /// - /// - /// true if the folder was successfully purged - bool PurgeFolder(string userID, InventoryFolderBase folder, UUID session_id); - - /// - /// Get items from a folder. - /// - /// - /// true if the folder was successfully purged - List GetFolderItems(string userID, UUID folderID, UUID session_id); - - /// - /// Add a new item to the user's inventory - /// - /// - /// true if the item was successfully added - bool AddItem(string userID, InventoryItemBase item, UUID session_id); - - /// - /// Update an item in the user's inventory - /// - /// - /// true if the item was successfully updated - bool UpdateItem(string userID, InventoryItemBase item, UUID session_id); - - bool MoveItems(string userID, List items, UUID session_id); - - /// - /// Delete an item from the user's inventory - /// - /// - /// true if the item was successfully deleted - bool DeleteItems(string userID, List itemIDs, UUID session_id); - - InventoryItemBase QueryItem(string userID, InventoryItemBase item, UUID session_id); - - InventoryFolderBase QueryFolder(string userID, InventoryFolderBase item, UUID session_id); - - int GetAssetPermissions(string userID, UUID assetID, UUID session_id); - - } -} diff --git a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs deleted file mode 100644 index f86b453665..0000000000 --- a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs +++ /dev/null @@ -1,582 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using log4net; -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using Nini.Config; -using OpenSim.Framework; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Services.Interfaces; -using OpenMetaverse; - -namespace OpenSim.Services.Connectors -{ - public class InventoryServicesConnector : ISessionAuthInventoryService - { - private static readonly ILog m_log = - LogManager.GetLogger( - MethodBase.GetCurrentMethod().DeclaringType); - - private string m_ServerURI = String.Empty; - - private Dictionary m_RequestingInventory = new Dictionary(); - private Dictionary m_RequestTime = new Dictionary(); - - public InventoryServicesConnector() - { - } - - public InventoryServicesConnector(string serverURI) - { - m_ServerURI = serverURI.TrimEnd('/'); - } - - public InventoryServicesConnector(IConfigSource source) - { - Initialise(source); - } - - public virtual void Initialise(IConfigSource source) - { - IConfig inventoryConfig = source.Configs["InventoryService"]; - if (inventoryConfig == null) - { - m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); - throw new Exception("InventoryService missing from OpenSim.ini"); - } - - string serviceURI = inventoryConfig.GetString("InventoryServerURI", - String.Empty); - - if (serviceURI == String.Empty) - { - m_log.Error("[INVENTORY CONNECTOR]: No Server URI named in section InventoryService"); - throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); - } - m_ServerURI = serviceURI.TrimEnd('/'); - } - - #region ISessionAuthInventoryService - - public string Host - { - get { return m_ServerURI; } - } - - /// - /// Caller must catch eventual Exceptions. - /// - /// - /// - /// - public void GetUserInventory(string userIDStr, UUID sessionID, InventoryReceiptCallback callback) - { - UUID userID = UUID.Zero; - if (UUID.TryParse(userIDStr, out userID)) - { - lock (m_RequestingInventory) - { - // *HACK ALERT* - - // If an inventory request times out, it blocks any further requests from the - // same user, even after a relog. This is bad, and makes me sad. - - // Really, we should detect a timeout and report a failure to the callback, - // BUT in my testing i found that it's hard to detect a timeout.. sometimes, - // a partial response is recieved, and sometimes a null response. - - // So, for now, add a timer of ten seconds (which is the request timeout). - - // This should basically have the same effect. - - lock (m_RequestTime) - { - if (m_RequestTime.ContainsKey(userID)) - { - TimeSpan interval = DateTime.Now - m_RequestTime[userID]; - if (interval.TotalSeconds > 10) - { - m_RequestTime.Remove(userID); - if (m_RequestingInventory.ContainsKey(userID)) - { - m_RequestingInventory.Remove(userID); - } - } - } - if (!m_RequestingInventory.ContainsKey(userID)) - { - m_RequestTime.Add(userID, DateTime.Now); - m_RequestingInventory.Add(userID, callback); - } - else - { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetUserInventory - ignoring repeated request for user {0}", userID); - return; - } - } - } - - m_log.InfoFormat( - "[INVENTORY CONNECTOR]: Requesting inventory from {0}/GetInventory/ for user {1}", - m_ServerURI, userID); - - RestSessionObjectPosterResponse requester - = new RestSessionObjectPosterResponse(); - requester.ResponseCallback = InventoryResponse; - - requester.BeginPostObject(m_ServerURI + "/GetInventory/", userID.Guid, sessionID.ToString(), userID.ToString()); - } - } - - /// - /// Gets the user folder for the given folder-type - /// - /// - /// - /// - public Dictionary GetSystemFolders(string userID, UUID sessionID) - { - List folders = null; - Dictionary dFolders = new Dictionary(); - try - { - folders = SynchronousRestSessionObjectPoster>.BeginPostObject( - "POST", m_ServerURI + "/SystemFolders/", new Guid(userID), sessionID.ToString(), userID.ToString()); - - foreach (InventoryFolderBase f in folders) - dFolders[(AssetType)f.Type] = f; - - return dFolders; - } - catch (Exception e) - { - // Maybe we're talking to an old inventory server. Try this other thing. - m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetSystemFolders operation failed, {0} {1} (old sever?). Trying GetInventory.", - e.Source, e.Message); - - try - { - InventoryCollection inventory = SynchronousRestSessionObjectPoster.BeginPostObject( - "POST", m_ServerURI + "/GetInventory/", new Guid(userID), sessionID.ToString(), userID.ToString()); - folders = inventory.Folders; - } - catch (Exception ex) - { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetInventory operation also failed, {0} {1}. Giving up.", - e.Source, ex.Message); - } - - if ((folders != null) && (folders.Count > 0)) - { - m_log.DebugFormat("[INVENTORY CONNECTOR]: Received entire inventory ({0} folders) for user {1}", - folders.Count, userID); - foreach (InventoryFolderBase f in folders) - { - if ((f.Type != (short)AssetType.Folder) && (f.Type != (short)AssetType.Unknown)) - dFolders[(AssetType)f.Type] = f; - } - - UUID rootFolderID = dFolders[AssetType.Animation].ParentID; - InventoryFolderBase rootFolder = new InventoryFolderBase(rootFolderID, new UUID(userID)); - rootFolder = QueryFolder(userID, rootFolder, sessionID); - dFolders[AssetType.Folder] = rootFolder; - m_log.DebugFormat("[INVENTORY CONNECTOR]: {0} system folders for user {1}", dFolders.Count, userID); - return dFolders; - } - } - - return new Dictionary(); - } - - /// - /// Gets everything (folders and items) inside a folder - /// - /// - /// - /// - public InventoryCollection GetFolderContent(string userID, UUID folderID, UUID sessionID) - { - try - { - // normal case - return SynchronousRestSessionObjectPoster.BeginPostObject( - "POST", m_ServerURI + "/GetFolderContent/", folderID.Guid, sessionID.ToString(), userID.ToString()); - } - catch (TimeoutException e) - { - m_log.ErrorFormat( - "[INVENTORY CONNECTOR]: GetFolderContent operation to {0} for {1} timed out {2} {3}.", - m_ServerURI, folderID, e.Source, e.Message); - } - catch (Exception e) - { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderContent operation failed for {0}, {1} {2} (old server?).", - folderID, e.Source, e.Message); - } - - InventoryCollection nullCollection = new InventoryCollection(); - nullCollection.Folders = new List(); - nullCollection.Items = new List(); - nullCollection.UserID = new UUID(userID); - return nullCollection; - } - - public bool AddFolder(string userID, InventoryFolderBase folder, UUID sessionID) - { - try - { - return SynchronousRestSessionObjectPoster.BeginPostObject( - "POST", m_ServerURI + "/NewFolder/", folder, sessionID.ToString(), folder.Owner.ToString()); - } - catch (Exception e) - { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: Add new inventory folder operation failed for {0} {1}, {2} {3}", - folder.Name, folder.ID, e.Source, e.Message); - } - - return false; - } - - public bool UpdateFolder(string userID, InventoryFolderBase folder, UUID sessionID) - { - try - { - return SynchronousRestSessionObjectPoster.BeginPostObject( - "POST", m_ServerURI + "/UpdateFolder/", folder, sessionID.ToString(), folder.Owner.ToString()); - } - catch (Exception e) - { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: Update inventory folder operation failed for {0} {1}, {2} {3}", - folder.Name, folder.ID, e.Source, e.Message); - } - - return false; - } - - public bool DeleteFolders(string userID, List folderIDs, UUID sessionID) - { - try - { - List guids = new List(); - foreach (UUID u in folderIDs) - guids.Add(u.Guid); - return SynchronousRestSessionObjectPoster, bool>.BeginPostObject( - "POST", m_ServerURI + "/DeleteFolders/", guids, sessionID.ToString(), userID); - } - catch (Exception e) - { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: Delete inventory folders operation failed, {0} {1}", - e.Source, e.Message); - } - - return false; - } - - public bool MoveFolder(string userID, InventoryFolderBase folder, UUID sessionID) - { - try - { - return SynchronousRestSessionObjectPoster.BeginPostObject( - "POST", m_ServerURI + "/MoveFolder/", folder, sessionID.ToString(), folder.Owner.ToString()); - } - catch (Exception e) - { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: Move inventory folder operation failed for {0} {1}, {2} {3}", - folder.Name, folder.ID, e.Source, e.Message); - } - - return false; - } - - public bool PurgeFolder(string userID, InventoryFolderBase folder, UUID sessionID) - { - try - { - return SynchronousRestSessionObjectPoster.BeginPostObject( - "POST", m_ServerURI + "/PurgeFolder/", folder, sessionID.ToString(), folder.Owner.ToString()); - } - catch (Exception e) - { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: Purge inventory folder operation failed for {0} {1}, {2} {3}", - folder.Name, folder.ID, e.Source, e.Message); - } - - return false; - } - - public List GetFolderItems(string userID, UUID folderID, UUID sessionID) - { - try - { - InventoryFolderBase folder = new InventoryFolderBase(folderID, new UUID(userID)); - return SynchronousRestSessionObjectPoster>.BeginPostObject( - "POST", m_ServerURI + "/GetItems/", folder, sessionID.ToString(), userID); - } - catch (Exception e) - { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: Get folder items operation failed for folder {0}, {1} {2}", - folderID, e.Source, e.Message); - } - - return null; - } - - public bool AddItem(string userID, InventoryItemBase item, UUID sessionID) - { - try - { - return SynchronousRestSessionObjectPoster.BeginPostObject( - "POST", m_ServerURI + "/NewItem/", item, sessionID.ToString(), item.Owner.ToString()); - } - catch (Exception e) - { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: Add new inventory item operation failed for {0} {1}, {2} {3}", - item.Name, item.ID, e.Source, e.Message); - } - - return false; - } - - public bool UpdateItem(string userID, InventoryItemBase item, UUID sessionID) - { - try - { - return SynchronousRestSessionObjectPoster.BeginPostObject( - "POST", m_ServerURI + "/NewItem/", item, sessionID.ToString(), item.Owner.ToString()); - } - catch (Exception e) - { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: Update new inventory item operation failed for {0} {1}, {2} {3}", - item.Name, item.ID, e.Source, e.Message); - } - - return false; - } - - /** - * MoveItems Async group - */ - - delegate void MoveItemsDelegate(string userID, List items, UUID sessionID); - - private void MoveItemsAsync(string userID, List items, UUID sessionID) - { - if (items == null) - { - m_log.WarnFormat("[INVENTORY CONNECTOR]: request to move items got a null list."); - return; - } - - try - { - //SynchronousRestSessionObjectPoster, bool>.BeginPostObject( - // "POST", m_ServerURI + "/MoveItems/", items, sessionID.ToString(), userID.ToString()); - - //// Success - //return; - string uri = m_ServerURI + "/inventory/" + userID; - if (SynchronousRestObjectRequester. - MakeRequest, bool>("PUT", uri, items)) - m_log.DebugFormat("[INVENTORY CONNECTOR]: move {0} items poster succeeded {1}", items.Count, uri); - else - m_log.DebugFormat("[INVENTORY CONNECTOR]: move {0} items poster failed {1}", items.Count, uri); ; - - return; - - } - catch (Exception e) - { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: Move inventory items operation failed, {0} {1} (old server?). Trying slow way.", - e.Source, e.Message); - } - - } - - private void MoveItemsCompleted(IAsyncResult iar) - { - MoveItemsDelegate d = (MoveItemsDelegate)iar.AsyncState; - d.EndInvoke(iar); - } - - public bool MoveItems(string userID, List items, UUID sessionID) - { - MoveItemsDelegate d = MoveItemsAsync; - d.BeginInvoke(userID, items, sessionID, MoveItemsCompleted, d); - return true; - } - - public bool DeleteItems(string userID, List items, UUID sessionID) - { - try - { - List guids = new List(); - foreach (UUID u in items) - guids.Add(u.Guid); - return SynchronousRestSessionObjectPoster, bool>.BeginPostObject( - "POST", m_ServerURI + "/DeleteItem/", guids, sessionID.ToString(), userID); - } - catch (Exception e) - { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: Delete inventory items operation failed, {0} {1}", - e.Source, e.Message); - } - - return false; - } - - public InventoryItemBase QueryItem(string userID, InventoryItemBase item, UUID sessionID) - { - try - { - return SynchronousRestSessionObjectPoster.BeginPostObject( - "POST", m_ServerURI + "/QueryItem/", item, sessionID.ToString(), item.Owner.ToString()); - } - catch (Exception e) - { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: Query inventory item operation failed, {0} {1}", - e.Source, e.Message); - } - - return null; - } - - public InventoryFolderBase QueryFolder(string userID, InventoryFolderBase folder, UUID sessionID) - { - try - { - return SynchronousRestSessionObjectPoster.BeginPostObject( - "POST", m_ServerURI + "/QueryFolder/", folder, sessionID.ToString(), userID); - } - catch (Exception e) - { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: Query inventory folder operation failed, {0} {1}", - e.Source, e.Message); - } - - return null; - } - - public int GetAssetPermissions(string userID, UUID assetID, UUID sessionID) - { - try - { - InventoryItemBase item = new InventoryItemBase(); - item.Owner = new UUID(userID); - item.AssetID = assetID; - return SynchronousRestSessionObjectPoster.BeginPostObject( - "POST", m_ServerURI + "/AssetPermissions/", item, sessionID.ToString(), userID); - } - catch (Exception e) - { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: AssetPermissions operation failed, {0} {1}", - e.Source, e.Message); - } - - return 0; - } - - #endregion - - /// - /// Callback used by the inventory server GetInventory request - /// - /// - private void InventoryResponse(InventoryCollection response) - { - UUID userID = response.UserID; - InventoryReceiptCallback callback = null; - lock (m_RequestingInventory) - { - if (m_RequestingInventory.ContainsKey(userID)) - { - callback = m_RequestingInventory[userID]; - m_RequestingInventory.Remove(userID); - lock (m_RequestTime) - { - if (m_RequestTime.ContainsKey(userID)) - { - m_RequestTime.Remove(userID); - } - } - } - else - { - m_log.WarnFormat( - "[INVENTORY CONNECTOR]: " + - "Received inventory response for {0} for which we do not have a record of requesting!", - userID); - return; - } - } - - m_log.InfoFormat("[INVENTORY CONNECTOR]: " + - "Received inventory response for user {0} containing {1} folders and {2} items", - userID, response.Folders.Count, response.Items.Count); - - InventoryFolderImpl rootFolder = null; - - ICollection folders = new List(); - ICollection items = new List(); - - foreach (InventoryFolderBase folder in response.Folders) - { - if (folder.ParentID == UUID.Zero) - { - rootFolder = new InventoryFolderImpl(folder); - folders.Add(rootFolder); - - break; - } - } - - if (rootFolder != null) - { - foreach (InventoryFolderBase folder in response.Folders) - { - if (folder.ID != rootFolder.ID) - { - folders.Add(new InventoryFolderImpl(folder)); - } - } - - foreach (InventoryItemBase item in response.Items) - { - items.Add(item); - } - } - else - { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: Did not get back an inventory containing a root folder for user {0}", userID); - } - - callback(folders, items); - } - } -} diff --git a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs deleted file mode 100644 index a7aa1382c4..0000000000 --- a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using log4net; -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using Nini.Config; -using OpenSim.Framework; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Services.Interfaces; -using OpenMetaverse; - -namespace OpenSim.Services.Connectors -{ - /// - /// This connector is temporary. It's used by the user server, before that server is refactored. - /// - public class QuickAndDirtyInventoryServiceConnector : IInventoryService - { -// private static readonly ILog m_log = -// LogManager.GetLogger( -// MethodBase.GetCurrentMethod().DeclaringType); - - private string m_ServerURI = String.Empty; - - //private Dictionary m_RequestingInventory = new Dictionary(); - - public QuickAndDirtyInventoryServiceConnector() - { - } - - public QuickAndDirtyInventoryServiceConnector(string serverURI) - { - m_ServerURI = serverURI.TrimEnd('/'); - } - - /// - /// - /// - /// - /// - public bool CreateUserInventory(UUID userId) - { - return SynchronousRestObjectPoster.BeginPostObject( - "POST", m_ServerURI + "CreateInventory/", userId.Guid); - } - - /// - /// - /// - /// - /// - public List GetInventorySkeleton(UUID userId) - { - return SynchronousRestObjectPoster.BeginPostObject>( - "POST", m_ServerURI + "RootFolders/", userId.Guid); - } - - /// - /// Returns a list of all the active gestures in a user's inventory. - /// - /// - /// The of the user - /// - /// - /// A flat list of the gesture items. - /// - public List GetActiveGestures(UUID userId) - { - return SynchronousRestObjectPoster.BeginPostObject>( - "POST", m_ServerURI + "ActiveGestures/", userId.Guid); - } - - public InventoryCollection GetUserInventory(UUID userID) - { - return null; - } - - public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) - { - } - - public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) - { - return null; - } - - public InventoryCollection GetFolderContent(UUID userID, UUID folderID) - { - return null; - } - - public List GetFolderItems(UUID userID, UUID folderID) - { - return null; - } - - public bool AddFolder(InventoryFolderBase folder) - { - return false; - } - - public bool UpdateFolder(InventoryFolderBase folder) - { - return false; - } - - public bool MoveFolder(InventoryFolderBase folder) - { - return false; - } - - public bool DeleteFolders(UUID ownerID, List folderIDs) - { - return false; - } - - - public bool PurgeFolder(InventoryFolderBase folder) - { - return false; - } - - public bool AddItem(InventoryItemBase item) - { - return false; - } - - public bool UpdateItem(InventoryItemBase item) - { - return false; - } - - public bool MoveItems(UUID ownerID, List items) - { - return false; - } - - public bool DeleteItems(UUID owner, List itemIDs) - { - return false; - } - - public InventoryItemBase GetItem(InventoryItemBase item) - { - return null; - } - - public InventoryFolderBase GetFolder(InventoryFolderBase folder) - { - return null; - } - - public bool HasInventoryForUser(UUID userID) - { - return false; - } - - public InventoryFolderBase GetRootFolder(UUID userID) - { - return null; - } - - public int GetAssetPermissions(UUID userID, UUID assetID) - { - return 0; - } - - } -} diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs index dd8fe2b800..93fdae38c1 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs @@ -87,16 +87,17 @@ namespace OpenSim.Region.OptionalModules.Simian if (String.IsNullOrEmpty(m_serverUrl)) return; - m_refreshtime = Convert.ToInt32(config.GetString("RefreshTime")); - if (m_refreshtime <= 0) + int refreshseconds = Convert.ToInt32(config.GetString("RefreshTime")); + if (refreshseconds <= 0) return; + m_refreshtime = refreshseconds * 1000; // convert from seconds to ms m_log.InfoFormat("[SIMIAN MAPTILE] enabled with refresh timeout {0} and URL {1}", m_refreshtime,m_serverUrl); - + m_enabled = true; } - + /// /// /// @@ -106,7 +107,7 @@ namespace OpenSim.Region.OptionalModules.Simian { m_refreshTimer.Enabled = true; m_refreshTimer.AutoReset = true; - m_refreshTimer.Interval = 5 * 60 * 1000; // every 5 minutes + m_refreshTimer.Interval = 5 * 60 * 1000; // every 5 minutes m_refreshTimer.Elapsed += new ElapsedEventHandler(HandleMaptileRefresh); } } @@ -120,12 +121,12 @@ namespace OpenSim.Region.OptionalModules.Simian if (! m_enabled) return; - // Every shared region module has to maintain an indepedent list of - // currently running regions + // Every shared region module has to maintain an indepedent list of + // currently running regions lock (m_scenes) m_scenes[scene.RegionInfo.RegionID] = scene; } - + /// /// /// @@ -150,7 +151,7 @@ namespace OpenSim.Region.OptionalModules.Simian // loaded and initialized if (m_lastrefresh > 0 && Util.EnvironmentTickCountSubtract(m_lastrefresh) < m_refreshtime) return; - + m_log.DebugFormat("[SIMIAN MAPTILE] map refresh fired"); lock (m_scenes) { @@ -169,7 +170,7 @@ namespace OpenSim.Region.OptionalModules.Simian m_lastrefresh = Util.EnvironmentTickCount(); } - + /// /// /// @@ -211,7 +212,7 @@ namespace OpenSim.Region.OptionalModules.Simian HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl); request.Timeout = 20000; request.ReadWriteTimeout = 5000; - + using (HttpWebResponse response = MultipartForm.Post(request, postParameters)) { using (Stream responseStream = response.GetResponseStream()) diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 042d0749ea..cc6bffb7bb 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -48,6 +48,9 @@ namespace OpenSim.Services.Connectors.Simulation { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + // we use this dictionary to track the pending updateagent requests, maps URI --> position update + private Dictionary m_updateAgentQueue = new Dictionary(); + //private GridRegion m_Region; public SimulationServiceConnector() @@ -133,9 +136,56 @@ namespace OpenSim.Services.Connectors.Simulation /// public bool UpdateAgent(GridRegion destination, AgentPosition data) { - // we need a better throttle for these - return false; - // return UpdateAgent(destination, (IAgentData)data); + // The basic idea of this code is that the first thread that needs to + // send an update for a specific avatar becomes the worker for any subsequent + // requests until there are no more outstanding requests. Further, only send the most + // recent update; this *should* never be needed but some requests get + // slowed down and once that happens the problem with service end point + // limits kicks in and nothing proceeds + string uri = destination.ServerURI + AgentPath() + data.AgentID + "/"; + lock (m_updateAgentQueue) + { + if (m_updateAgentQueue.ContainsKey(uri)) + { + // Another thread is already handling + // updates for this simulator, just update + // the position and return, overwrites are + // not a problem since we only care about the + // last update anyway + m_updateAgentQueue[uri] = data; + return true; + } + + // Otherwise update the reference and start processing + m_updateAgentQueue[uri] = data; + } + + AgentPosition pos = null; + while (true) + { + lock (m_updateAgentQueue) + { + // save the position + AgentPosition lastpos = pos; + + pos = m_updateAgentQueue[uri]; + + // this is true if no one put a new + // update in the map since the last + // one we processed, if thats the + // case then we are done + if (pos == lastpos) + { + m_updateAgentQueue.Remove(uri); + return true; + } + } + + UpdateAgent(destination,(IAgentData)pos); + } + + // unreachable + return true; } /// diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index fe5ef489e1..4a397e22c4 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -286,7 +286,7 @@ namespace OpenSim.Services.GridService } } - m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighours", region.RegionName, rinfos.Count); + m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighbours", region.RegionName, rinfos.Count); return rinfos; } diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 588c1dd0ed..9d98c8f59c 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -220,9 +220,15 @@ namespace OpenSim.Services.GridService string[] parts = mapName.Split(new char[] {' '}); string regionName = String.Empty; if (parts.Length > 1) - regionName = parts[1]; + { + regionName = mapName.Substring(parts[0].Length + 1); + regionName = regionName.Trim(new char[] {'"'}); + } if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, parts[0], ownerID, out regInfo, out reason)) + { + regInfo.RegionName = mapName; return regInfo; + } } return null; @@ -317,9 +323,9 @@ namespace OpenSim.Services.GridService regInfo.RegionID = regionID; - if ( externalName == string.Empty ) + if (externalName == string.Empty) regInfo.RegionName = regInfo.ServerURI; - else + else regInfo.RegionName = externalName; m_log.Debug("[HYPERGRID LINKER]: naming linked region " + regInfo.RegionName); diff --git a/bin/HttpServer_OpenSim.dll b/bin/HttpServer_OpenSim.dll index d7503a0915..a7a1303c63 100644 Binary files a/bin/HttpServer_OpenSim.dll and b/bin/HttpServer_OpenSim.dll differ diff --git a/bin/HttpServer_OpenSim.pdb b/bin/HttpServer_OpenSim.pdb index 4151588c66..c6f3b235f1 100644 Binary files a/bin/HttpServer_OpenSim.pdb and b/bin/HttpServer_OpenSim.pdb differ diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 7245bee2e3..5bac56e66a 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -306,6 +306,9 @@ [ODEPhysicsSettings] ;# {mesh_sculpted_prim} {[Startup]physics:OpenDynamicsEngine} {Mesh sculpties so they collide as they look?} {true false} true ;; Do we want to mesh sculpted prim to collide like they look? + ;; If you are seeing sculpt texture decode problems + ;; (messages such as "Decoded image with unhandled number of components: 0 shortly followed by a physcs exception") + ;; then you might want to try setting this to false. ; mesh_sculpted_prim = true ;# {use_NINJA_physics_joints} {[Startup]physics:OpenDynamicsEngine} {Use jointed (NINJA) physics?} {true false} false diff --git a/bin/assets/TexturesAssetSet/TexturesAssetSet.xml b/bin/assets/TexturesAssetSet/TexturesAssetSet.xml index 5484ee237f..3af9c994d1 100644 --- a/bin/assets/TexturesAssetSet/TexturesAssetSet.xml +++ b/bin/assets/TexturesAssetSet/TexturesAssetSet.xml @@ -413,6 +413,15 @@ + + + +
+ + + + +
diff --git a/bin/config-include/GridCommon.ini.example b/bin/config-include/GridCommon.ini.example index 761e5eb1dd..e1bcf00f51 100644 --- a/bin/config-include/GridCommon.ini.example +++ b/bin/config-include/GridCommon.ini.example @@ -88,6 +88,10 @@ ; accessible from other grids ; ProfileServerURI = "http://mygridserver.com:8002/user" + ;; If you want to protect your assets from being copied by foreign visitors + ;; uncomment the next line. You may want to do this on sims that have licensed content. + ; OutboundPermission = False + [Modules] ;; 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 0b011168d8..89d6be79e3 100644 --- a/bin/config-include/HyperSimianGrid.ini +++ b/bin/config-include/HyperSimianGrid.ini @@ -82,3 +82,14 @@ [Profiles] Module = "SimianProfiles" + +[HGInventoryAccessModule] + ; + ; === HG ONLY === + ; Change this to your profile server + ; accessible from other grids + ; + ProfileServerURI = "http://mygridserver.com:8002/user" + ;; If you want to protect your assets from being copied by foreign visitors + ;; uncomment the next line. You may want to do this on sims that have licensed content. + ; OutboundPermission = False diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example index 4956bc34fa..213219c12b 100644 --- a/bin/config-include/StandaloneCommon.ini.example +++ b/bin/config-include/StandaloneCommon.ini.example @@ -33,6 +33,10 @@ [HGInventoryAccessModule] ProfileServerURI = "http://127.0.0.1:9000/profiles" + ;; If you want to protect your assets from being copied by foreign visitors + ;; uncomment the next line. You may want to do this on sims that have licensed content. + ; OutboundPermission = False + [Modules] ;; Choose 0 or 1 cache modules, and the corresponding config file, if it exists. diff --git a/bin/sqlite3.dll b/bin/sqlite3.dll index 558a015a7f..f29dc625fa 100755 Binary files a/bin/sqlite3.dll and b/bin/sqlite3.dll differ