diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs index aec06be6bf..59431bbfaa 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs @@ -851,7 +851,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory // Delete the old item - Rest.InventoryServices.DeleteItem(uri); + List uuids = new List(); + uuids.Add(uri.ID); + Rest.InventoryServices.DeleteItems(uri.Owner, uuids); // Add the new item to the inventory @@ -927,7 +929,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory InventoryItemBase item = (InventoryItemBase) InventoryNode; Rest.Log.DebugFormat("{0} {1}: Item {2} will be deleted", MsgId, rdata.method, rdata.path); - Rest.InventoryServices.DeleteItem(item); + List uuids = new List(); + uuids.Add(item.ID); + Rest.InventoryServices.DeleteItems(item.Owner, uuids); rdata.appendStatus(String.Format("

Deleted item {0} UUID {1}

", item.Name, item.ID)); } diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index ca641d063b..238810ab00 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs @@ -653,7 +653,9 @@ namespace OpenSim.Framework.Communications.Cache if (RootFolder.DeleteItem(item.ID)) { - return m_InventoryService.DeleteItem(item); + List uuids = new List(); + uuids.Add(itemID); + return m_InventoryService.DeleteItems(this.UserProfile.ID, uuids); } } else diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs index 22dcef9bc8..6f86704cdc 100644 --- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs @@ -547,7 +547,12 @@ namespace OpenSim.Framework.Communications.Tests return false; } - public bool DeleteItem(InventoryItemBase item) + public bool MoveItems(UUID owner, List items) + { + return false; + } + + public bool DeleteItems(UUID owner, List items) { return false; } diff --git a/OpenSim/Framework/GridConfig.cs b/OpenSim/Framework/GridConfig.cs index a3c103280e..87fd3f0275 100644 --- a/OpenSim/Framework/GridConfig.cs +++ b/OpenSim/Framework/GridConfig.cs @@ -45,6 +45,8 @@ namespace OpenSim.Framework public string SimSendKey = String.Empty; public string UserRecvKey = String.Empty; public string UserSendKey = String.Empty; + public string ConsoleUser = String.Empty; + public string ConsolePass = String.Empty; public GridConfig(string description, string filename) { @@ -95,6 +97,12 @@ namespace OpenSim.Framework "Allow regions to register immediately upon grid server startup? true/false", "True", false); + m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "Remote console access user name [Default: disabled]", "0", false); + + m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "Remote console access password [Default: disabled]", "0", false); + } public bool handleIncomingConfiguration(string configuration_key, object configuration_result) @@ -140,9 +148,15 @@ namespace OpenSim.Framework case "allow_region_registration": AllowRegionRegistration = (bool)configuration_result; break; + case "console_user": + ConsoleUser = (string)configuration_result; + break; + case "console_pass": + ConsolePass = (string)configuration_result; + break; } return true; } } -} \ No newline at end of file +} diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index e451dd8874..c6cdcaa8d8 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -254,10 +254,10 @@ namespace OpenSim.Framework string newName); public delegate void MoveInventoryItem( - IClientAPI remoteClient, UUID folderID, UUID itemID, int length, string newName); + IClientAPI remoteClient, List items); public delegate void RemoveInventoryItem( - IClientAPI remoteClient, UUID itemID); + IClientAPI remoteClient, List itemIDs); public delegate void RemoveInventoryFolder( IClientAPI remoteClient, UUID folderID); diff --git a/OpenSim/Framework/InventoryFolderBase.cs b/OpenSim/Framework/InventoryFolderBase.cs index 05f11a491c..1869d48f90 100644 --- a/OpenSim/Framework/InventoryFolderBase.cs +++ b/OpenSim/Framework/InventoryFolderBase.cs @@ -78,6 +78,12 @@ namespace OpenSim.Framework ID = id; } + public InventoryFolderBase(UUID id, UUID owner) + { + ID = id; + Owner = owner; + } + public InventoryFolderBase(UUID id, string name, UUID owner, short type, UUID parent, ushort version) { ID = id; diff --git a/OpenSim/Framework/MessageServerConfig.cs b/OpenSim/Framework/MessageServerConfig.cs index d0ceebc82f..61e5ea7550 100644 --- a/OpenSim/Framework/MessageServerConfig.cs +++ b/OpenSim/Framework/MessageServerConfig.cs @@ -46,6 +46,8 @@ namespace OpenSim.Framework public string UserRecvKey = String.Empty; public string UserSendKey = String.Empty; public string UserServerURL = String.Empty; + public string ConsoleUser = String.Empty; + public string ConsolePass = String.Empty; public MessageServerConfig(string description, string filename) { @@ -88,6 +90,12 @@ namespace OpenSim.Framework "Use SSL? true/false", ConfigSettings.DefaultMessageServerHttpSSL.ToString(), false); m_configMember.addConfigurationOption("published_ip", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "My Published IP Address", "127.0.0.1", false); + m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "Remote console access user name [Default: disabled]", "0", false); + + m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "Remote console access password [Default: disabled]", "0", false); + } public bool handleIncomingConfiguration(string configuration_key, object configuration_result) @@ -130,9 +138,15 @@ namespace OpenSim.Framework case "published_ip": MessageServerIP = (string) configuration_result; break; + case "console_user": + ConsoleUser = (string)configuration_result; + break; + case "console_pass": + ConsolePass = (string)configuration_result; + break; } return true; } } -} \ No newline at end of file +} diff --git a/OpenSim/Framework/UserConfig.cs b/OpenSim/Framework/UserConfig.cs index 31838ad155..b9e366553c 100644 --- a/OpenSim/Framework/UserConfig.cs +++ b/OpenSim/Framework/UserConfig.cs @@ -46,6 +46,8 @@ namespace OpenSim.Framework public bool HttpSSL = ConfigSettings.DefaultUserServerHttpSSL; public uint DefaultUserLevel = 0; public string LibraryXmlfile = ""; + public string ConsoleUser = String.Empty; + public string ConsolePass = String.Empty; private Uri m_inventoryUrl; @@ -155,6 +157,12 @@ namespace OpenSim.Framework m_configMember.addConfigurationOption("default_loginLevel", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Minimum Level a user should have to login [0 default]", "0", false); + m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "Remote console access user name [Default: disabled]", "0", false); + + m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "Remote console access password [Default: disabled]", "0", false); + } public bool handleIncomingConfiguration(string configuration_key, object configuration_result) @@ -209,6 +217,12 @@ namespace OpenSim.Framework case "library_location": LibraryXmlfile = (string)configuration_result; break; + case "console_user": + ConsoleUser = (string)configuration_result; + break; + case "console_pass": + ConsolePass = (string)configuration_result; + break; } return true; diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs index c41a728e05..e3ad52abb1 100644 --- a/OpenSim/Grid/GridServer/GridServerBase.cs +++ b/OpenSim/Grid/GridServer/GridServerBase.cs @@ -31,6 +31,7 @@ using System.IO; using System.Reflection; using System.Timers; using log4net; +using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; @@ -46,6 +47,8 @@ namespace OpenSim.Grid.GridServer private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected GridConfig m_config; + public string m_consoleType = "local"; + public IConfigSource m_configSource = null; public GridConfig Config { @@ -71,16 +74,36 @@ namespace OpenSim.Grid.GridServer public GridServerBase() { - m_console = new LocalConsole("Grid"); - MainConsole.Instance = m_console; } protected override void StartupSpecific() { + switch (m_consoleType) + { + case "rest": + m_console = new RemoteConsole("Grid"); + break; + case "basic": + m_console = new CommandConsole("Grid"); + break; + default: + m_console = new LocalConsole("Grid"); + break; + } + MainConsole.Instance = m_console; m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml"))); m_log.Info("[GRID]: Starting HTTP process"); m_httpServer = new BaseHttpServer(m_config.HttpPort); + if (m_console is RemoteConsole) + { + RemoteConsole c = (RemoteConsole)m_console; + c.SetServer(m_httpServer); + IConfig netConfig = m_configSource.AddConfig("Network"); + netConfig.Set("ConsoleUser", m_config.ConsoleUser); + netConfig.Set("ConsolePass", m_config.ConsolePass); + c.ReadConfig(m_configSource); + } LoadPlugins(); diff --git a/OpenSim/Grid/GridServer/Program.cs b/OpenSim/Grid/GridServer/Program.cs index 9618b855d2..c7ba897b9a 100644 --- a/OpenSim/Grid/GridServer/Program.cs +++ b/OpenSim/Grid/GridServer/Program.cs @@ -26,6 +26,7 @@ */ using log4net.Config; +using Nini.Config; namespace OpenSim.Grid.GridServer { @@ -33,10 +34,21 @@ namespace OpenSim.Grid.GridServer { public static void Main(string[] args) { + ArgvConfigSource argvSource = new ArgvConfigSource(args); + argvSource.AddSwitch("Startup", "console", "c"); + XmlConfigurator.Configure(); GridServerBase app = new GridServerBase(); + IConfig startupConfig = argvSource.Configs["Startup"]; + if (startupConfig != null) + { + app.m_consoleType = startupConfig.GetString("console", "local"); + } + + app.m_configSource = argvSource; + // if (args.Length > 0 && args[0] == "-setuponly") // { // app.Config(); diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs index dcefeea8e3..654e770dfd 100644 --- a/OpenSim/Grid/MessagingServer/Main.cs +++ b/OpenSim/Grid/MessagingServer/Main.cs @@ -30,6 +30,7 @@ using System.Collections.Generic; using System.IO; using System.Reflection; using log4net; +using Nini.Config; using log4net.Config; using OpenSim.Framework; using OpenSim.Framework.Console; @@ -56,8 +57,22 @@ namespace OpenSim.Grid.MessagingServer // private UUID m_lastCreatedUser = UUID.Random(); + protected static string m_consoleType = "local"; + protected static IConfigSource m_config = null; + public static void Main(string[] args) { + ArgvConfigSource argvSource = new ArgvConfigSource(args); + argvSource.AddSwitch("Startup", "console", "c"); + + IConfig startupConfig = argvSource.Configs["Startup"]; + if (startupConfig != null) + { + m_consoleType = startupConfig.GetString("console", "local"); + } + + m_config = argvSource; + XmlConfigurator.Configure(); m_log.Info("[SERVER]: Launching MessagingServer..."); @@ -70,7 +85,18 @@ namespace OpenSim.Grid.MessagingServer public OpenMessage_Main() { - m_console = new LocalConsole("Messaging"); + switch (m_consoleType) + { + case "rest": + m_console = new RemoteConsole("Messaging"); + break; + case "basic": + m_console = new CommandConsole("Messaging"); + break; + default: + m_console = new LocalConsole("Messaging"); + break; + } MainConsole.Instance = m_console; } @@ -88,20 +114,33 @@ namespace OpenSim.Grid.MessagingServer { if (m_userServerModule.registerWithUserServer()) { - m_log.Info("[SERVER]: Starting HTTP process"); - m_httpServer = new BaseHttpServer(Cfg.HttpPort); + if (m_httpServer == null) + { + m_log.Info("[SERVER]: Starting HTTP process"); + m_httpServer = new BaseHttpServer(Cfg.HttpPort); - m_httpServer.AddXmlRPCHandler("login_to_simulator", msgsvc.UserLoggedOn); - m_httpServer.AddXmlRPCHandler("logout_of_simulator", msgsvc.UserLoggedOff); - m_httpServer.AddXmlRPCHandler("get_presence_info_bulk", msgsvc.GetPresenceInfoBulk); - m_httpServer.AddXmlRPCHandler("process_region_shutdown", msgsvc.ProcessRegionShutdown); - m_httpServer.AddXmlRPCHandler("agent_location", msgsvc.AgentLocation); - m_httpServer.AddXmlRPCHandler("agent_leaving", msgsvc.AgentLeaving); + if (m_console is RemoteConsole) + { + RemoteConsole c = (RemoteConsole)m_console; + c.SetServer(m_httpServer); + IConfig netConfig = m_config.AddConfig("Network"); + netConfig.Set("ConsoleUser", Cfg.ConsoleUser); + netConfig.Set("ConsolePass", Cfg.ConsolePass); + c.ReadConfig(m_config); + } - m_httpServer.AddXmlRPCHandler("region_startup", m_regionModule.RegionStartup); - m_httpServer.AddXmlRPCHandler("region_shutdown", m_regionModule.RegionShutdown); + m_httpServer.AddXmlRPCHandler("login_to_simulator", msgsvc.UserLoggedOn); + m_httpServer.AddXmlRPCHandler("logout_of_simulator", msgsvc.UserLoggedOff); + m_httpServer.AddXmlRPCHandler("get_presence_info_bulk", msgsvc.GetPresenceInfoBulk); + m_httpServer.AddXmlRPCHandler("process_region_shutdown", msgsvc.ProcessRegionShutdown); + m_httpServer.AddXmlRPCHandler("agent_location", msgsvc.AgentLocation); + m_httpServer.AddXmlRPCHandler("agent_leaving", msgsvc.AgentLeaving); - m_httpServer.Start(); + m_httpServer.AddXmlRPCHandler("region_startup", m_regionModule.RegionStartup); + m_httpServer.AddXmlRPCHandler("region_shutdown", m_regionModule.RegionShutdown); + + m_httpServer.Start(); + } m_log.Info("[SERVER]: Userserver registration was successful"); } else @@ -114,12 +153,12 @@ namespace OpenSim.Grid.MessagingServer private void deregisterFromUserServer() { m_userServerModule.deregisterWithUserServer(); - if (m_httpServer != null) - { +// if (m_httpServer != null) +// { // try a completely fresh registration, with fresh handlers, too - m_httpServer.Stop(); - m_httpServer = null; - } +// m_httpServer.Stop(); +// m_httpServer = null; +// } m_console.Output("[SERVER]: Deregistered from userserver."); } diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 86c2abb8d7..1ee53ef6ec 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs @@ -43,6 +43,7 @@ using OpenSim.Framework.Statistics; using OpenSim.Grid.Communications.OGS1; using OpenSim.Grid.Framework; using OpenSim.Grid.UserServer.Modules; +using Nini.Config; namespace OpenSim.Grid.UserServer { @@ -73,8 +74,22 @@ namespace OpenSim.Grid.UserServer protected AvatarCreationModule m_appearanceModule; + protected static string m_consoleType = "local"; + protected static IConfigSource m_config = null; + public static void Main(string[] args) { + ArgvConfigSource argvSource = new ArgvConfigSource(args); + argvSource.AddSwitch("Startup", "console", "c"); + + IConfig startupConfig = argvSource.Configs["Startup"]; + if (startupConfig != null) + { + m_consoleType = startupConfig.GetString("console", "local"); + } + + m_config = argvSource; + XmlConfigurator.Configure(); m_log.Info("Launching UserServer..."); @@ -87,7 +102,18 @@ namespace OpenSim.Grid.UserServer public OpenUser_Main() { - m_console = new LocalConsole("User"); + switch (m_consoleType) + { + case "rest": + m_console = new RemoteConsole("User"); + break; + case "basic": + m_console = new CommandConsole("User"); + break; + default: + m_console = new LocalConsole("User"); + break; + } MainConsole.Instance = m_console; } @@ -129,6 +155,16 @@ namespace OpenSim.Grid.UserServer m_httpServer = new BaseHttpServer(Cfg.HttpPort); + if (m_console is RemoteConsole) + { + RemoteConsole c = (RemoteConsole)m_console; + c.SetServer(m_httpServer); + IConfig netConfig = m_config.AddConfig("Network"); + netConfig.Set("ConsoleUser", Cfg.ConsoleUser); + netConfig.Set("ConsolePass", Cfg.ConsolePass); + c.ReadConfig(m_config); + } + RegisterInterface(m_console); RegisterInterface(Cfg); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 06bea3dc38..6969a3db1d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -6633,9 +6633,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else // Agent { - //InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(itemID); IInventoryService invService = m_scene.RequestModuleInterface(); - InventoryItemBase assetRequestItem = invService.GetItem(new InventoryItemBase(itemID)); + InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, AgentId); + assetRequestItem = invService.GetItem(assetRequestItem); if (assetRequestItem == null) { assetRequestItem = ((Scene)m_scene).CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID); @@ -7027,14 +7027,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (OnMoveInventoryItem != null) { handlerMoveInventoryItem = null; + InventoryItemBase itm = null; + List items = new List(); foreach (MoveInventoryItemPacket.InventoryDataBlock datablock in moveitem.InventoryData) { - handlerMoveInventoryItem = OnMoveInventoryItem; - if (handlerMoveInventoryItem != null) - { - handlerMoveInventoryItem(this, datablock.FolderID, datablock.ItemID, datablock.Length, - Util.FieldToString(datablock.NewName)); - } + itm = new InventoryItemBase(datablock.ItemID, AgentId); + itm.Folder = datablock.FolderID; + itm.Name = Util.FieldToString(datablock.NewName); + // weird, comes out as empty string + //m_log.DebugFormat("[XXX] new name: {0}", itm.Name); + items.Add(itm); + } + handlerMoveInventoryItem = OnMoveInventoryItem; + if (handlerMoveInventoryItem != null) + { + handlerMoveInventoryItem(this, items); } } break; @@ -7053,14 +7060,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (OnRemoveInventoryItem != null) { handlerRemoveInventoryItem = null; + List uuids = new List(); foreach (RemoveInventoryItemPacket.InventoryDataBlock datablock in removeItem.InventoryData) { - handlerRemoveInventoryItem = OnRemoveInventoryItem; - if (handlerRemoveInventoryItem != null) - { - handlerRemoveInventoryItem(this, datablock.ItemID); - } + uuids.Add(datablock.ItemID); } + handlerRemoveInventoryItem = OnRemoveInventoryItem; + if (handlerRemoveInventoryItem != null) + { + handlerRemoveInventoryItem(this, uuids); + } + } break; case PacketType.RemoveInventoryFolder: @@ -7116,13 +7126,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (OnRemoveInventoryItem != null) { handlerRemoveInventoryItem = null; + List uuids = new List(); foreach (RemoveInventoryObjectsPacket.ItemDataBlock datablock in removeObject.ItemData) { - handlerRemoveInventoryItem = OnRemoveInventoryItem; - if (handlerRemoveInventoryItem != null) - { - handlerRemoveInventoryItem(this, datablock.ItemID); - } + uuids.Add(datablock.ItemID); + } + handlerRemoveInventoryItem = OnRemoveInventoryItem; + if (handlerRemoveInventoryItem != null) + { + handlerRemoveInventoryItem(this, uuids); } } break; diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs index bf0b06d87d..798c1e7041 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs @@ -128,28 +128,36 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Store the throttle multiplier for posterity. throttleMultiplier = userSettings.ClientThrottleMultipler; + + int throttleMaxBPS = 1500000; + if (userSettings.TotalThrottleSettings != null) + throttleMaxBPS = userSettings.TotalThrottleSettings.Max; + // Set up the throttle classes (min, max, current) in bits per second - ResendThrottle = new LLPacketThrottle(5000, 100000, 16000, userSettings.ClientThrottleMultipler); - LandThrottle = new LLPacketThrottle(1000, 100000, 2000, userSettings.ClientThrottleMultipler); - WindThrottle = new LLPacketThrottle(0, 100000, 0, userSettings.ClientThrottleMultipler); - CloudThrottle = new LLPacketThrottle(0, 100000, 0, userSettings.ClientThrottleMultipler); - TaskThrottle = new LLPacketThrottle(1000, 800000, 3000, userSettings.ClientThrottleMultipler); - AssetThrottle = new LLPacketThrottle(1000, 800000, 1000, userSettings.ClientThrottleMultipler); - TextureThrottle = new LLPacketThrottle(1000, 800000, 4000, userSettings.ClientThrottleMultipler); - - // Total Throttle trumps all - it is the number of bits in total that are allowed to go out per second. + ResendThrottle = new LLPacketThrottle(5000, throttleMaxBPS / 15, 16000, userSettings.ClientThrottleMultipler); + LandThrottle = new LLPacketThrottle(1000, throttleMaxBPS / 15, 2000, userSettings.ClientThrottleMultipler); + WindThrottle = new LLPacketThrottle(0, throttleMaxBPS / 15, 0, userSettings.ClientThrottleMultipler); + CloudThrottle = new LLPacketThrottle(0, throttleMaxBPS / 15, 0, userSettings.ClientThrottleMultipler); + TaskThrottle = new LLPacketThrottle(1000, throttleMaxBPS / 2, 3000, userSettings.ClientThrottleMultipler); + AssetThrottle = new LLPacketThrottle(1000, throttleMaxBPS / 2, 1000, userSettings.ClientThrottleMultipler); + TextureThrottle = new LLPacketThrottle(1000, throttleMaxBPS / 2, 4000, userSettings.ClientThrottleMultipler); + + + // Total Throttle trumps all - it is the number of bits in total that are allowed to go out per second. + + ThrottleSettings totalThrottleSettings = userSettings.TotalThrottleSettings; if (null == totalThrottleSettings) - { - totalThrottleSettings = new ThrottleSettings(0, 1500000, 28000); + { + totalThrottleSettings = new ThrottleSettings(0, throttleMaxBPS, 28000); } - - TotalThrottle + + TotalThrottle = new LLPacketThrottle( totalThrottleSettings.Min, totalThrottleSettings.Max, totalThrottleSettings.Current, userSettings.ClientThrottleMultipler); - throttleTimer = new Timer((int) (throttletimems/throttleTimeDivisor)); + throttleTimer = new Timer((int)(throttletimems / throttleTimeDivisor)); throttleTimer.Elapsed += ThrottleTimerElapsed; throttleTimer.Start(); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 5184e35186..9ee8df5bb9 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -152,11 +152,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP ClientStackUserSettings userSettings = new ClientStackUserSettings(); IConfig config = configSource.Configs["ClientStack.LindenUDP"]; - + if (config != null) { + if (config.Contains("client_throttle_max_bps")) + { + int maxBPS = config.GetInt("client_throttle_max_bps", 1500000); + userSettings.TotalThrottleSettings = new ThrottleSettings(0, maxBPS, + maxBPS > 28000 ? maxBPS : 28000); + } + if (config.Contains("client_throttle_multiplier")) - userSettings.ClientThrottleMultipler = config.GetFloat("client_throttle_multiplier"); + userSettings.ClientThrottleMultipler = config.GetFloat("client_throttle_multiplier"); if (config.Contains("client_socket_rcvbuf_size")) m_clientSocketReceiveBuffer = config.GetInt("client_socket_rcvbuf_size"); } diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 582beeead8..35c59aa6d7 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -130,7 +130,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } else { - InventoryItemBase baseItem = invService.GetItem(new InventoryItemBase(appearance.Wearables[i].ItemID)); + InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i].ItemID, userID); + baseItem = invService.GetItem(baseItem); if (baseItem != null) { diff --git a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs index a68db1b7c5..ff1236104a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs @@ -65,7 +65,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures { IInventoryService invService = m_scene.InventoryService; - InventoryItemBase item = invService.GetItem(new InventoryItemBase(gestureId)); + InventoryItemBase item = new InventoryItemBase(gestureId, client.AgentId); + item = invService.GetItem(item); if (item != null) { item.Flags = 1; @@ -80,7 +81,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures { IInventoryService invService = m_scene.InventoryService; - InventoryItemBase item = invService.GetItem(new InventoryItemBase(gestureId)); + InventoryItemBase item = new InventoryItemBase(gestureId, client.AgentId); + item = invService.GetItem(item); if (item != null) { item.Flags = 0; diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 5315c119a4..5afbf686e1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -257,8 +257,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer invService.GetFolderForType(client.AgentId, AssetType.TrashFolder); UUID inventoryEntityID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip - - InventoryItemBase item = invService.GetItem(new InventoryItemBase(inventoryEntityID)); + + InventoryItemBase item = new InventoryItemBase(inventoryEntityID, client.AgentId); + item = invService.GetItem(item); InventoryFolderBase folder = null; if (item != null && trashFolder != null) @@ -266,12 +267,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer item.Folder = trashFolder.ID; // Diva comment: can't we just update this item??? - invService.DeleteItem(item); + List uuids = new List(); + uuids.Add(item.ID); + invService.DeleteItems(item.Owner, uuids); scene.AddInventoryItem(client, item); } else { - folder = invService.GetFolder(new InventoryFolderBase(inventoryEntityID)); + folder = new InventoryFolderBase(inventoryEntityID, client.AgentId); + folder = invService.GetFolder(folder); if (folder != null & trashFolder != null) { @@ -451,10 +455,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer else { UUID itemID = new UUID(msg.binaryBucket, 1); - InventoryItemBase item = new InventoryItemBase(); - - item.ID = itemID; - item.Owner = user.ControllingClient.AgentId; + InventoryItemBase item = new InventoryItemBase(itemID, user.ControllingClient.AgentId); // Fetch from service // diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs index ef5ffe1ebd..d4cb61663a 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs @@ -181,12 +181,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory /// true if the item was successfully updated public abstract bool UpdateItem(InventoryItemBase item); + public abstract bool MoveItems(UUID ownerID, List items); + ///

/// Delete an item from the user's inventory /// /// /// true if the item was successfully deleted - public abstract bool DeleteItem(InventoryItemBase item); + public abstract bool DeleteItems(UUID ownerID, List itemIDs); public abstract InventoryItemBase GetItem(InventoryItemBase item); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index dd451ef94f..787c6c8b17 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs @@ -290,7 +290,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory public override List GetFolderItems(UUID userID, UUID folderID) { - return new List(); + if (IsLocalGridUser(userID)) + return m_GridService.GetFolderItems(userID, folderID); + else + { + UUID sessionID = GetSessionID(userID); + string uri = GetUserInventoryURI(userID) + "/" + userID; + return m_HGService.GetFolderItems(uri, folderID, sessionID); + } } public override bool AddFolder(InventoryFolderBase folder) @@ -386,18 +393,39 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } } - public override bool DeleteItem(InventoryItemBase item) + public override bool MoveItems(UUID ownerID, List items) { - if (item == null) + if (items == null) return false; + if (items.Count == 0) + return true; - if (IsLocalGridUser(item.Owner)) - return m_GridService.DeleteItem(item); + if (IsLocalGridUser(ownerID)) + return m_GridService.MoveItems(ownerID, items); else { - UUID sessionID = GetSessionID(item.Owner); - string uri = GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString(); - return m_HGService.DeleteItem(uri, item, sessionID); + UUID sessionID = GetSessionID(ownerID); + string uri = GetUserInventoryURI(ownerID) + "/" + ownerID.ToString(); + return m_HGService.MoveItems(uri, items, sessionID); + } + } + + public override bool DeleteItems(UUID ownerID, List itemIDs) + { + m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID); + + if (itemIDs == null) + return false; + if (itemIDs.Count == 0) + return true; + + if (IsLocalGridUser(ownerID)) + return m_GridService.DeleteItems(ownerID, itemIDs); + else + { + UUID sessionID = GetSessionID(ownerID); + string uri = GetUserInventoryURI(ownerID) + "/" + ownerID.ToString(); + return m_HGService.DeleteItems(uri, itemIDs, sessionID); } } @@ -483,12 +511,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI); string uri = m_LocalGridInventoryURI.TrimEnd('/'); - m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, comparing {0} to {1}.", userInventoryServerURI, uri); - if ((userInventoryServerURI == uri) || (userInventoryServerURI == "")) { return true; } + m_log.DebugFormat("[HG INVENTORY CONNECTOR]: user {0} is foreign({1} - {2})", userID, userInventoryServerURI, uri); return false; } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index 2fbc5fe2cc..562c5dd91f 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs @@ -289,14 +289,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_InventoryService.UpdateItem(item); } + + public override bool MoveItems(UUID ownerID, List items) + { + return m_InventoryService.MoveItems(ownerID, items); + } + /// /// Delete an item from the user's inventory /// /// /// true if the item was successfully deleted - public override bool DeleteItem(InventoryItemBase item) + public override bool DeleteItems(UUID ownerID, List itemIDs) { - return m_InventoryService.DeleteItem(item); + return m_InventoryService.DeleteItems(ownerID, itemIDs); } public override InventoryItemBase GetItem(InventoryItemBase item) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs index bef716b5c6..201442c2b4 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs @@ -212,7 +212,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory public override List GetFolderItems(UUID userID, UUID folderID) { - return new List(); + UUID sessionID = GetSessionID(userID); + return m_RemoteConnector.GetFolderItems(userID.ToString(), folderID, sessionID); } public override bool AddFolder(InventoryFolderBase folder) @@ -272,13 +273,25 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_RemoteConnector.UpdateItem(item.Owner.ToString(), item, sessionID); } - public override bool DeleteItem(InventoryItemBase item) + public override bool MoveItems(UUID ownerID, List items) { - if (item == null) + if (items == null) return false; - UUID sessionID = GetSessionID(item.Owner); - return m_RemoteConnector.DeleteItem(item.Owner.ToString(), item, sessionID); + 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) @@ -320,14 +333,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory private UUID GetSessionID(UUID userID) { - if (m_Scene == null) - { - m_log.Debug("[INVENTORY CONNECTOR]: OOPS! scene is null"); - } + //if (m_Scene == null) + //{ + // m_log.Debug("[INVENTORY CONNECTOR]: OOPS! scene is null"); + //} if (m_UserProfileService == null) { - m_log.Debug("[INVENTORY CONNECTOR]: OOPS! UserProfileCacheService is null"); + //m_log.Debug("[INVENTORY CONNECTOR]: OOPS! UserProfileCacheService is null"); return UUID.Zero; } diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 9c71b41d79..f3605779f9 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -966,7 +966,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions if (objectID == UUID.Zero) // User inventory { IInventoryService invService = m_scene.InventoryService; - InventoryItemBase assetRequestItem = invService.GetItem(new InventoryItemBase(notecard)); + InventoryItemBase assetRequestItem = new InventoryItemBase(notecard, user); + assetRequestItem = invService.GetItem(assetRequestItem); if (assetRequestItem == null) // Library item { assetRequestItem = scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard); @@ -1385,7 +1386,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions if (objectID == UUID.Zero) // User inventory { IInventoryService invService = m_scene.InventoryService; - InventoryItemBase assetRequestItem = invService.GetItem(new InventoryItemBase(script)); + InventoryItemBase assetRequestItem = new InventoryItemBase(script, user); + assetRequestItem = invService.GetItem(assetRequestItem); if (assetRequestItem == null) // Library item { assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(script); @@ -1479,7 +1481,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions if (objectID == UUID.Zero) // User inventory { IInventoryService invService = m_scene.InventoryService; - InventoryItemBase assetRequestItem = invService.GetItem(new InventoryItemBase(notecard)); + InventoryItemBase assetRequestItem = new InventoryItemBase(notecard, user); + assetRequestItem = invService.GetItem(assetRequestItem); if (assetRequestItem == null) // Library item { assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard); diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 46777e120e..a119efcf55 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -140,7 +140,8 @@ namespace OpenSim.Region.Framework.Scenes /// public virtual UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data) { - InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); + InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); + item = InventoryService.GetItem(item); if (item != null) { @@ -315,7 +316,8 @@ namespace OpenSim.Region.Framework.Scenes public void UpdateInventoryItemAsset(IClientAPI remoteClient, UUID transactionID, UUID itemID, InventoryItemBase itemUpd) { - InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); + InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); + item = InventoryService.GetItem(item); if (item != null) { @@ -408,7 +410,8 @@ namespace OpenSim.Region.Framework.Scenes { Console.WriteLine("Scene.Inventory.cs: GiveInventoryItem"); - InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemId)); + InventoryItemBase item = new InventoryItemBase(itemId, senderId); + item = InventoryService.GetItem(item); if ((item != null) && (item.Owner == senderId)) { @@ -474,7 +477,11 @@ namespace OpenSim.Region.Framework.Scenes if (!Permissions.BypassPermissions()) { if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) - InventoryService.DeleteItem(new InventoryItemBase(itemId)); + { + List items = new List(); + items.Add(itemId); + InventoryService.DeleteItems(senderId, items); + } } return itemCopy; @@ -558,7 +565,8 @@ namespace OpenSim.Region.Framework.Scenes if (item == null) { - item = InventoryService.GetItem(new InventoryItemBase(oldItemID)); + item = new InventoryItemBase(oldItemID, remoteClient.AgentId); + item = InventoryService.GetItem(item); if (item == null) { @@ -630,33 +638,13 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - public void MoveInventoryItem(IClientAPI remoteClient, UUID folderID, UUID itemID, int length, - string newName) + public void MoveInventoryItem(IClientAPI remoteClient, List items) { m_log.DebugFormat( - "[AGENT INVENTORY]: Moving item {0} to {1} for {2}", itemID, folderID, remoteClient.AgentId); + "[AGENT INVENTORY]: Moving {0} items for user {1}", items.Count, remoteClient.AgentId); - InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); - - if (item != null) - { - if (newName != String.Empty) - { - item.Name = newName; - } - item.Folder = folderID; - - // Diva comment: can't we just update? - InventoryService.DeleteItem(item); - - AddInventoryItem(remoteClient, item); - } - else - { - m_log.Warn("[AGENT INVENTORY]: Failed to find item " + itemID.ToString()); - - return; - } + if (!InventoryService.MoveItems(remoteClient.AgentId, items)) + m_log.Warn("[AGENT INVENTORY]: Failed to move items for user " + remoteClient.AgentId); } /// @@ -794,9 +782,10 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - private void RemoveInventoryItem(IClientAPI remoteClient, UUID itemID) + private void RemoveInventoryItem(IClientAPI remoteClient, List itemIDs) { - InventoryService.DeleteItem(new InventoryItemBase(itemID)); + //m_log.Debug("[SCENE INVENTORY]: user " + remoteClient.AgentId); + InventoryService.DeleteItems(remoteClient.AgentId, itemIDs); } /// @@ -1224,7 +1213,8 @@ namespace OpenSim.Region.Framework.Scenes UUID copyID = UUID.Random(); if (itemID != UUID.Zero) { - InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); + InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); + item = InventoryService.GetItem(item); // Try library if (null == item) @@ -1242,7 +1232,11 @@ namespace OpenSim.Region.Framework.Scenes if (!Permissions.BypassPermissions()) { if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) - RemoveInventoryItem(remoteClient, itemID); + { + List uuids = new List(); + uuids.Add(itemID); + RemoveInventoryItem(remoteClient, uuids); + } } } else @@ -1287,7 +1281,8 @@ namespace OpenSim.Region.Framework.Scenes if (itemID != UUID.Zero) // transferred from an avatar inventory to the prim's inventory { - InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); + InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); + item = InventoryService.GetItem(item); // Try library // XXX clumsy, possibly should be one call @@ -1672,7 +1667,7 @@ namespace OpenSim.Region.Framework.Scenes if (DeRezAction.SaveToExistingUserInventoryItem == action) { - item = new InventoryItemBase(objectGroup.RootPart.FromUserInventoryItemID); + item = new InventoryItemBase(objectGroup.RootPart.FromUserInventoryItemID, userID); item = InventoryService.GetItem(item); //item = userInfo.RootFolder.FindItem( @@ -1834,7 +1829,8 @@ namespace OpenSim.Region.Framework.Scenes string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup); - InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); + InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); + item = InventoryService.GetItem(item); if (item != null) { @@ -1984,7 +1980,8 @@ namespace OpenSim.Region.Framework.Scenes BypassRayCast, bRayEndIsIntersection,true,scale, false); // Rez object - InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); + InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); + item = InventoryService.GetItem(item); if (item != null) { @@ -2135,7 +2132,11 @@ namespace OpenSim.Region.Framework.Scenes // copy ones will be lost, so avoid it // if (!attachment) - InventoryService.DeleteItem(item); + { + List uuids = new List(); + uuids.Add(item.ID); + InventoryService.DeleteItems(item.Owner, uuids); + } } } @@ -2309,7 +2310,8 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence presence; if (TryGetAvatar(remoteClient.AgentId, out presence)) { - InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID, remoteClient.AgentId)); + InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); + item = InventoryService.GetItem(item); presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); IAvatarFactory ava = RequestModuleInterface(); @@ -2360,7 +2362,8 @@ namespace OpenSim.Region.Framework.Scenes if (TryGetAvatar(remoteClient.AgentId, out presence)) { // XXYY!! - InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); + InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); + item = InventoryService.GetItem(item); presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); IAvatarFactory ava = RequestModuleInterface(); if (ava != null) @@ -2393,7 +2396,9 @@ namespace OpenSim.Region.Framework.Scenes } part.ParentGroup.DetachToGround(); - InventoryService.DeleteItem(new InventoryItemBase(inventoryID)); + List uuids = new List(); + uuids.Add(inventoryID); + InventoryService.DeleteItems(remoteClient.AgentId, uuids); remoteClient.SendRemoveInventoryItem(inventoryID); } SendAttachEvent(part.ParentGroup.LocalId, itemID, UUID.Zero); diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index fde922f04d..77b980c1e0 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System; using System.Collections.Generic; using System.Threading; using OpenMetaverse; @@ -404,7 +405,8 @@ namespace OpenSim.Region.Framework.Scenes return; } - InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); + InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); + item = InventoryService.GetItem(item); if (item != null) { @@ -557,15 +559,34 @@ namespace OpenSim.Region.Framework.Scenes /// /// + delegate void PurgeFolderDelegate(UUID userID, UUID folder); + public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID) { - InventoryFolderBase folder = new InventoryFolderBase(folderID); + PurgeFolderDelegate d = PurgeFolderAsync; + try + { + d.BeginInvoke(remoteClient.AgentId, folderID, PurgeFolderCompleted, d); + } + catch (Exception e) + { + m_log.WarnFormat("[AGENT INVENTORY]: Exception on purge folder for user {0}: {1}", remoteClient.AgentId, e.Message); + } + } + + + private void PurgeFolderAsync(UUID userID, UUID folderID) + { + InventoryFolderBase folder = new InventoryFolderBase(folderID, userID); if (InventoryService.PurgeFolder(folder)) m_log.DebugFormat("[AGENT INVENTORY]: folder {0} purged successfully", folderID); else m_log.WarnFormat("[AGENT INVENTORY]: could not purge folder {0}", folderID); - } + } + private void PurgeFolderCompleted(IAsyncResult iar) + { + } } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 2dbbf70388..4e665e9893 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1978,6 +1978,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_Rotation(q.X, q.Y, q.Z, q.W); } + private LSL_Rotation GetPartRot( SceneObjectPart part ) + { + Quaternion q; + if (part.LinkNum == 0 || part.LinkNum == 1) // unlinked or root prim + { + if (part.ParentGroup.RootPart.AttachmentPoint != 0) + { + ScenePresence avatar = World.GetScenePresence(part.AttachedAvatar); + if (avatar != null) + if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) + q = avatar.CameraRotation; // Mouselook + else + q = avatar.Rotation; // Currently infrequently updated so may be inaccurate + else + q = part.ParentGroup.GroupRotation; // Likely never get here but just in case + } + else + q = part.ParentGroup.GroupRotation; // just the group rotation + return new LSL_Rotation(q.X, q.Y, q.Z, q.W); + } + q = part.GetWorldRotation(); + return new LSL_Rotation(q.X, q.Y, q.Z, q.W); + } + public LSL_Rotation llGetLocalRot() { m_host.AddScriptLPS(1); @@ -7299,7 +7323,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api break; case (int)ScriptBaseClass.PRIM_ROTATION: - res.Add(llGetRot()); + res.Add(GetPartRot(part)); break; case (int)ScriptBaseClass.PRIM_TYPE: diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index 619c2d1c96..1d9eb0d241 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -65,6 +65,10 @@ namespace OpenSim.Server.Base // private bool m_Running = true; + // PID file + // + private string m_pidFile = String.Empty; + // Handle all the automagical stuff // public ServicesServerBase(string prompt, string[] args) @@ -211,6 +215,11 @@ namespace OpenSim.Server.Base } } + if (startupConfig.GetString("PIDFile", String.Empty) != String.Empty) + { + CreatePIDFile(startupConfig.GetString("PIDFile")); + } + // Register the quit command // MainConsole.Instance.Commands.AddCommand("base", false, "quit", @@ -230,6 +239,8 @@ namespace OpenSim.Server.Base MainConsole.Instance.Prompt(); } + if (m_pidFile != String.Empty) + File.Delete(m_pidFile); return 0; } @@ -246,5 +257,22 @@ namespace OpenSim.Server.Base protected virtual void Initialise() { } + + protected void CreatePIDFile(string path) + { + try + { + string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString(); + FileStream fs = File.Create(path); + System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); + Byte[] buf = enc.GetBytes(pidstring); + fs.Write(buf, 0, buf.Length); + fs.Close(); + m_pidFile = path; + } + catch (Exception) + { + } + } } } diff --git a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs index 30b3caec21..6ef1d9d32f 100644 --- a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs @@ -105,8 +105,8 @@ namespace OpenSim.Server.Handlers.Inventory "POST", "/PurgeFolder/", m_InventoryService.PurgeFolder, CheckAuthSession)); m_httpServer.AddStreamHandler( - new RestDeserialiseSecureHandler( - "POST", "/DeleteItem/", m_InventoryService.DeleteItem, CheckAuthSession)); + new RestDeserialiseSecureHandler, bool>( + "POST", "/DeleteItem/", DeleteItems, CheckAuthSession)); m_httpServer.AddStreamHandler( new RestDeserialiseSecureHandler( @@ -125,8 +125,8 @@ namespace OpenSim.Server.Handlers.Inventory "POST", "/NewFolder/", m_InventoryService.AddFolder, CheckAuthSession)); m_httpServer.AddStreamHandler( - new RestDeserialiseTrustedHandler( - "POST", "/CreateFolder/", m_InventoryService.AddFolder, CheckTrustSource)); + new RestDeserialiseSecureHandler( + "POST", "/CreateFolder/", m_InventoryService.AddFolder, CheckAuthSession)); m_httpServer.AddStreamHandler( new RestDeserialiseSecureHandler( @@ -137,9 +137,13 @@ namespace OpenSim.Server.Handlers.Inventory "POST", "/AddNewItem/", m_InventoryService.AddItem, CheckTrustSource)); m_httpServer.AddStreamHandler( - new RestDeserialiseTrustedHandler>( - "POST", "/GetItems/", GetFolderItems, CheckTrustSource)); + new RestDeserialiseSecureHandler>( + "POST", "/GetItems/", GetFolderItems, CheckAuthSession)); + m_httpServer.AddStreamHandler( + new RestDeserialiseSecureHandler, bool>( + "POST", "/MoveItems/", MoveItems, CheckAuthSession)); + // for persistent active gestures m_httpServer.AddStreamHandler( new RestDeserialiseTrustedHandler> @@ -247,6 +251,24 @@ namespace OpenSim.Server.Handlers.Inventory return m_InventoryService.GetAssetPermissions(item.Owner, item.AssetID); } + public bool DeleteItems(List items) + { + List uuids = new List(); + foreach (Guid g in items) + uuids.Add(new UUID(g)); + // oops we lost the user info here. Bad bad handlers + return m_InventoryService.DeleteItems(UUID.Zero, uuids); + } + + public bool MoveItems(List items) + { + // oops we lost the user info here. Bad bad handlers + // let's peek at one item + UUID ownerID = UUID.Zero; + if (items.Count > 0) + ownerID = items[0].Owner; + return m_InventoryService.MoveItems(ownerID, items); + } #endregion /// diff --git a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs index 94b4ad92d1..45e921a670 100644 --- a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs @@ -214,6 +214,19 @@ namespace OpenSim.Services.Connectors.Inventory 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; @@ -240,7 +253,7 @@ namespace OpenSim.Services.Connectors.Inventory return false; } - public bool DeleteItem(string id, InventoryItemBase item, UUID sessionID) + public bool MoveItems(string id, List items, UUID sessionID) { string url = string.Empty; string userID = string.Empty; @@ -248,7 +261,20 @@ namespace OpenSim.Services.Connectors.Inventory if (StringToUrlAndUserID(id, out url, out userID)) { ISessionAuthInventoryService connector = GetConnector(url); - return connector.UpdateItem(userID, item, sessionID); + 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; } diff --git a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs index f50bcf5d72..c89c9b7ce0 100644 --- a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs +++ b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs @@ -95,6 +95,13 @@ namespace OpenSim.Services.Connectors /// 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 /// @@ -109,12 +116,14 @@ namespace OpenSim.Services.Connectors /// 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 DeleteItem(string userID, InventoryItemBase item, UUID session_id); + bool DeleteItems(string userID, List itemIDs, UUID session_id); InventoryItemBase QueryItem(string userID, InventoryItemBase item, UUID session_id); diff --git a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs index 5d94eaca5a..bcf9d87423 100644 --- a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs @@ -334,6 +334,23 @@ namespace OpenSim.Services.Connectors 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, {0} {1}", + e.Source, e.Message); + } + + return null; + } + public bool AddItem(string userID, InventoryItemBase item, UUID sessionID) { try @@ -366,12 +383,57 @@ namespace OpenSim.Services.Connectors return false; } - public bool DeleteItem(string userID, InventoryItemBase item, UUID sessionID) + /** + * MoveItems Async group + */ + + delegate void MoveItemsDelegate(string userID, List items, UUID sessionID); + + private void MoveItemsAsync(string userID, List items, UUID sessionID) { try { - return SynchronousRestSessionObjectPoster.BeginPostObject( - "POST", m_ServerURI + "/DeleteItem/", item, sessionID.ToString(), item.Owner.ToString()); + SynchronousRestSessionObjectPoster, bool>.BeginPostObject( + "POST", m_ServerURI + "/MoveItems/", items, sessionID.ToString(), userID.ToString()); + + // Success + 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); + } + + foreach (InventoryItemBase item in items) + { + InventoryItemBase itm = this.QueryItem(userID, item, sessionID); + itm.Name = item.Name; + itm.Folder = item.Folder; + this.UpdateItem(userID, itm, sessionID); + } + } + + private void MoveItemsCompleted(IAsyncResult 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) { diff --git a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs index 5cbd307f7a..cd283ff17e 100644 --- a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs @@ -151,7 +151,12 @@ namespace OpenSim.Services.Connectors return false; } - public bool DeleteItem(InventoryItemBase item) + public bool MoveItems(UUID ownerID, List items) + { + return false; + } + + public bool DeleteItems(UUID owner, List itemIDs) { return false; } diff --git a/OpenSim/Services/Interfaces/IInventoryService.cs b/OpenSim/Services/Interfaces/IInventoryService.cs index a89a238311..ebdb09a969 100644 --- a/OpenSim/Services/Interfaces/IInventoryService.cs +++ b/OpenSim/Services/Interfaces/IInventoryService.cs @@ -142,12 +142,15 @@ namespace OpenSim.Services.Interfaces /// true if the item was successfully updated bool UpdateItem(InventoryItemBase item); + bool MoveItems(UUID ownerID, List items); + /// /// Delete an item from the user's inventory /// /// /// true if the item was successfully deleted - bool DeleteItem(InventoryItemBase item); + //bool DeleteItem(InventoryItemBase item); + bool DeleteItems(UUID userID, List itemIDs); /// /// Get an item, given by its UUID diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs index 65c2d96031..e0217f6ede 100644 --- a/OpenSim/Services/InventoryService/InventoryService.cs +++ b/OpenSim/Services/InventoryService/InventoryService.cs @@ -386,13 +386,33 @@ namespace OpenSim.Services.InventoryService return true; } - // See IInventoryServices - public virtual bool DeleteItem(InventoryItemBase item) + public virtual bool MoveItems(UUID ownerID, List items) { m_log.InfoFormat( - "[INVENTORY SERVICE]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder); + "[INVENTORY SERVICE]: Moving {0} items from user {1}", items.Count, ownerID); - m_Database.deleteInventoryItem(item.ID); + InventoryItemBase itm = null; + foreach (InventoryItemBase item in items) + { + itm = GetInventoryItem(item.ID); + itm.Folder = item.Folder; + if ((item.Name != null) && !item.Name.Equals(string.Empty)) + itm.Name = item.Name; + m_Database.updateInventoryItem(itm); + } + + return true; + } + + // See IInventoryServices + public virtual bool DeleteItems(UUID owner, List itemIDs) + { + m_log.InfoFormat( + "[INVENTORY SERVICE]: Deleting {0} items from user {1}", itemIDs.Count, owner); + + // uhh..... + foreach (UUID uuid in itemIDs) + m_Database.deleteInventoryItem(uuid); // FIXME: Should return false on failure return true; @@ -439,10 +459,12 @@ namespace OpenSim.Services.InventoryService List items = GetFolderItems(folder.Owner, folder.ID); + List uuids = new List(); foreach (InventoryItemBase item in items) { - DeleteItem(item); + uuids.Add(item.ID); } + DeleteItems(folder.Owner, uuids); // FIXME: Should return false on failure return true; diff --git a/OpenSim/Tests/Common/Mock/TestInventoryService.cs b/OpenSim/Tests/Common/Mock/TestInventoryService.cs index ba9cbe9f93..ee22e5e14e 100644 --- a/OpenSim/Tests/Common/Mock/TestInventoryService.cs +++ b/OpenSim/Tests/Common/Mock/TestInventoryService.cs @@ -143,7 +143,12 @@ namespace OpenSim.Tests.Common.Mock return false; } - public bool DeleteItem(InventoryItemBase item) + public bool MoveItems(UUID ownerID, List items) + { + return false; + } + + public bool DeleteItems(UUID ownerID, List itemIDs) { return false; } diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 9a17c58c3e..cff5d19097 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -374,6 +374,9 @@ ; ; client_socket_rcvbuf_size = 8388608 + ; Maximum bits per second to send to any single client. This will override the user's viewer preference settings. + + ; client_throttle_max_bps = 1500000 [Chat] ; Controls whether the chat module is enabled. Default is true. diff --git a/prebuild.xml b/prebuild.xml index 5e4416984b..ebe5c62c00 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -911,6 +911,7 @@ + @@ -1178,6 +1179,7 @@ + @@ -1279,6 +1281,7 @@ +