From 40af8c256165eb6fb56f58e3c13ee9293e052f66 Mon Sep 17 00:00:00 2001 From: MW Date: Sun, 25 Mar 2007 17:34:58 +0000 Subject: You want large textures, you shall have! - Xfer system now working for large asset uploads Fixed the VS solution file. Now forwars ViewerEffect messages onto the other clients Renamed OpenSim.Framework/Inventory.cs to OpenSim.Framework/AgentInventory.cs --- OpenSim.Framework/AgentInventory.cs | 140 +++++++++++++++ OpenSim.Framework/Inventory.cs | 127 -------------- OpenSim.Framework/OpenSim.Framework.csproj | 35 ++-- OpenSim.Framework/OpenSim.Framework.dll.build | 126 +++++++------- OpenSim.Framework/Util.cs | 13 ++ OpenSim.RegionServer/AgentAssetUpload.cs | 212 +++++++++++++++++++++++ OpenSim.RegionServer/Assets/AssetCache.cs | 79 ++++----- OpenSim.RegionServer/Assets/InventoryCache.cs | 27 ++- OpenSim.RegionServer/OpenSim.RegionServer.csproj | 42 +++-- OpenSim.RegionServer/OpenSim.exe.build | 1 + OpenSim.RegionServer/SimClient.cs | 61 +++++-- OpenSim.sln | 130 ++++++-------- 12 files changed, 634 insertions(+), 359 deletions(-) create mode 100644 OpenSim.Framework/AgentInventory.cs delete mode 100644 OpenSim.Framework/Inventory.cs create mode 100644 OpenSim.RegionServer/AgentAssetUpload.cs diff --git a/OpenSim.Framework/AgentInventory.cs b/OpenSim.Framework/AgentInventory.cs new file mode 100644 index 0000000..8ab2f3a --- /dev/null +++ b/OpenSim.Framework/AgentInventory.cs @@ -0,0 +1,140 @@ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using OpenSim.Framework.Assets; + +namespace OpenSim.Framework.Inventory +{ + public class AgentInventory + { + //Holds the local copy of Inventory info for a agent + public Dictionary InventoryFolders; + public Dictionary InventoryItems; + public InventoryFolder InventoryRoot; + public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server + public LLUUID AgentID; + public AvatarWearable[] Wearables; + + public AgentInventory() + { + InventoryFolders = new Dictionary(); + InventoryItems = new Dictionary(); + this.Initialise(); + } + + public virtual void Initialise() + { + Wearables = new AvatarWearable[13]; //should be 12 of these + for (int i = 0; i < 13; i++) + { + Wearables[i] = new AvatarWearable(); + } + + InventoryRoot = new InventoryFolder(); + InventoryRoot.FolderID = LLUUID.Random(); + InventoryRoot.ParentID = new LLUUID(); + InventoryRoot.Version = 1; + InventoryRoot.DefaultType = 8; + InventoryRoot.FolderName = "My Inventory"; + InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot); + } + + public bool CreateNewFolder(LLUUID folderID, ushort type) + { + InventoryFolder Folder = new InventoryFolder(); + Folder.FolderID = folderID; + Folder.OwnerID = this.AgentID; + Folder.DefaultType = type; + this.InventoryFolders.Add(Folder.FolderID, Folder); + + return (true); + } + + public bool UpdateItem(LLUUID itemID, AssetBase asset) + { + if(this.InventoryItems.ContainsKey(itemID)) + { + InventoryItem Item = this.InventoryItems[itemID]; + Item.AssetID = asset.FullID; + Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated() + " so it now is set to asset " + asset.FullID.ToStringHyphenated()); + //TODO need to update the rest of the info + } + return true; + } + + public LLUUID AddToInventory(LLUUID folderID, AssetBase asset) + { + if (this.InventoryFolders.ContainsKey(folderID)) + { + LLUUID NewItemID = LLUUID.Random(); + + InventoryItem Item = new InventoryItem(); + Item.FolderID = folderID; + Item.OwnerID = AgentID; + Item.AssetID = asset.FullID; + Item.ItemID = NewItemID; + Item.Type = asset.Type; + Item.Name = asset.Name; + Item.Description = asset.Description; + Item.InvType = asset.InvType; + this.InventoryItems.Add(Item.ItemID, Item); + InventoryFolder Folder = InventoryFolders[Item.FolderID]; + Folder.Items.Add(Item); + return (Item.ItemID); + } + else + { + return (null); + } + } + } + + public class InventoryFolder + { + public List Items; + //public List Subfolders; + public LLUUID FolderID; + public LLUUID OwnerID; + public LLUUID ParentID; + public string FolderName; + public ushort DefaultType; + public ushort Version; + + public InventoryFolder() + { + Items = new List(); + //Subfolders = new List(); + } + + } + + public class InventoryItem + { + public LLUUID FolderID; + public LLUUID OwnerID; + public LLUUID ItemID; + public LLUUID AssetID; + public LLUUID CreatorID; + public sbyte InvType; + public sbyte Type; + public string Name; + public string Description; + + public InventoryItem() + { + this.CreatorID = LLUUID.Zero; + } + } + + public class AvatarWearable + { + public LLUUID AssetID = new LLUUID("00000000-0000-0000-0000-000000000000"); + public LLUUID ItemID = new LLUUID("00000000-0000-0000-0000-000000000000"); + + public AvatarWearable() + { + + } + } +} diff --git a/OpenSim.Framework/Inventory.cs b/OpenSim.Framework/Inventory.cs deleted file mode 100644 index e34ea75..0000000 --- a/OpenSim.Framework/Inventory.cs +++ /dev/null @@ -1,127 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife; -using OpenSim.Framework.Assets; - -namespace OpenSim.Framework.Inventory -{ - public class AgentInventory - { - //Holds the local copy of Inventory info for a agent - public Dictionary InventoryFolders; - public Dictionary InventoryItems; - public InventoryFolder InventoryRoot; - public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server - public LLUUID AgentID; - public AvatarWearable[] Wearables; - - public AgentInventory() - { - InventoryFolders = new Dictionary(); - InventoryItems = new Dictionary(); - this.Initialise(); - } - - public virtual void Initialise() - { - Wearables = new AvatarWearable[2]; //should be 12 of these - for (int i = 0; i < 2; i++) - { - Wearables[i] = new AvatarWearable(); - } - - InventoryRoot = new InventoryFolder(); - InventoryRoot.FolderID = LLUUID.Random(); - InventoryRoot.ParentID = new LLUUID(); - InventoryRoot.Version = 1; - InventoryRoot.DefaultType = 8; - InventoryRoot.FolderName = "My Inventory"; - InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot); - } - - public bool CreateNewFolder(LLUUID folderID) - { - InventoryFolder Folder = new InventoryFolder(); - Folder.FolderID = folderID; - Folder.OwnerID = this.AgentID; - this.InventoryFolders.Add(Folder.FolderID, Folder); - - return (true); - } - - public LLUUID AddToInventory(LLUUID folderID, AssetBase asset) - { - if (this.InventoryFolders.ContainsKey(folderID)) - { - LLUUID NewItemID = LLUUID.Random(); - - InventoryItem Item = new InventoryItem(); - Item.FolderID = folderID; - Item.OwnerID = AgentID; - Item.AssetID = asset.FullID; - Item.ItemID = NewItemID; - Item.Type = asset.Type; - Item.Name = asset.Name; - Item.Description = asset.Description; - Item.InvType = asset.InvType; - this.InventoryItems.Add(Item.ItemID, Item); - InventoryFolder Folder = InventoryFolders[Item.FolderID]; - Folder.Items.Add(Item); - return (Item.ItemID); - } - else - { - return (null); - } - } - } - - public class InventoryFolder - { - public List Items; - //public List Subfolders; - public LLUUID FolderID; - public LLUUID OwnerID; - public LLUUID ParentID; - public string FolderName; - public ushort DefaultType; - public ushort Version; - - public InventoryFolder() - { - Items = new List(); - //Subfolders = new List(); - } - - } - - public class InventoryItem - { - public LLUUID FolderID; - public LLUUID OwnerID; - public LLUUID ItemID; - public LLUUID AssetID; - public LLUUID CreatorID; - public sbyte InvType; - public sbyte Type; - public string Name; - public string Description; - - public InventoryItem() - { - this.CreatorID = LLUUID.Zero; - } - } - - public class AvatarWearable - { - public LLUUID AssetID = new LLUUID("00000000-0000-0000-0000-000000000000"); - public LLUUID ItemID = new LLUUID("00000000-0000-0000-0000-000000000000"); - - public AvatarWearable() - { - - } - } -} diff --git a/OpenSim.Framework/OpenSim.Framework.csproj b/OpenSim.Framework/OpenSim.Framework.csproj index 745874c..b250d18 100644 --- a/OpenSim.Framework/OpenSim.Framework.csproj +++ b/OpenSim.Framework/OpenSim.Framework.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,7 +6,8 @@ {71848571-2BC0-41DC-A69C-28B6DDB8C8CE} Debug AnyCPU - + + OpenSim.Framework @@ -15,9 +16,11 @@ IE50 false Library - + + OpenSim.Framework - + + @@ -28,7 +31,8 @@ TRACE;DEBUG - + + True 4096 False @@ -37,7 +41,8 @@ False False 4 - + + False @@ -46,7 +51,8 @@ TRACE - + + False 4096 True @@ -55,18 +61,19 @@ False False 4 - + + - + System.dll False - + System.Xml.dll False - + ..\bin\libsecondlife.dll False @@ -77,6 +84,7 @@ Code + Code @@ -98,9 +106,6 @@ Code - - Code - Code @@ -151,4 +156,4 @@ - + \ No newline at end of file diff --git a/OpenSim.Framework/OpenSim.Framework.dll.build b/OpenSim.Framework/OpenSim.Framework.dll.build index 3d29b2b..ccb2a60 100644 --- a/OpenSim.Framework/OpenSim.Framework.dll.build +++ b/OpenSim.Framework/OpenSim.Framework.dll.build @@ -1,63 +1,63 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim.Framework/Util.cs b/OpenSim.Framework/Util.cs index 042360d..440ce41 100644 --- a/OpenSim.Framework/Util.cs +++ b/OpenSim.Framework/Util.cs @@ -9,6 +9,8 @@ namespace OpenSim.Framework.Utilities public class Util { private static Random randomClass = new Random(); + private static uint nextXferID = 10000; + private static object XferLock = new object(); public static ulong UIntsToLong(uint X, uint Y) { @@ -23,6 +25,17 @@ namespace OpenSim.Framework.Utilities } } + public static uint GetNextXferID() + { + uint id = 0; + lock(XferLock) + { + id = nextXferID; + nextXferID++; + } + return id; + } + public Util() { diff --git a/OpenSim.RegionServer/AgentAssetUpload.cs b/OpenSim.RegionServer/AgentAssetUpload.cs new file mode 100644 index 0000000..2b4d78f --- /dev/null +++ b/OpenSim.RegionServer/AgentAssetUpload.cs @@ -0,0 +1,212 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Assets; +using OpenSim.Framework.Utilities; +using libsecondlife; +using libsecondlife.Packets; + +namespace OpenSim +{ + public class AgentAssetUpload + { + private Dictionary transactions = new Dictionary(); + private SimClient ourClient; + + public AgentAssetUpload(SimClient client) + { + this.ourClient = client; + } + + public void AddUpload(LLUUID transactionID, AssetBase asset) + { + Console.WriteLine("adding upload asset"); + AssetTransaction upload = new AssetTransaction(); + lock (this.transactions) + { + upload.Asset = asset; + upload.TransactionID = transactionID; + this.transactions.Add(transactionID, upload); + } + if (upload.Asset.Data.Length > 2) + { + //is complete + upload.UploadComplete = true; + AssetUploadCompletePacket response = new AssetUploadCompletePacket(); + response.AssetBlock.Type = asset.Type; + response.AssetBlock.Success = true; + response.AssetBlock.UUID = transactionID.Combine(this.ourClient.SecureSessionID); + this.ourClient.OutPacket(response); + } + else + { + Console.WriteLine(" no data in upload request so use xfer system"); + upload.UploadComplete = false; + upload.XferID = Util.GetNextXferID(); + RequestXferPacket xfer = new RequestXferPacket(); + xfer.XferID.ID = upload.XferID; + xfer.XferID.VFileType = upload.Asset.Type; + xfer.XferID.VFileID = transactionID.Combine(this.ourClient.SecureSessionID); + xfer.XferID.FilePath = 0; + xfer.XferID.Filename = new byte[0]; + this.ourClient.OutPacket(xfer); + } + + } + + public AssetBase GetUpload(LLUUID transactionID) + { + if (this.transactions.ContainsKey(transactionID)) + { + return this.transactions[transactionID].Asset; + } + + return null; + } + + public void HandleUploadPacket(AssetUploadRequestPacket pack, LLUUID assetID) + { + + AssetBase asset = null; + if (pack.AssetBlock.Type == 0) + { + + //first packet for transaction + asset = new AssetBase(); + asset.FullID = assetID; + asset.Type = pack.AssetBlock.Type; + asset.InvType = asset.Type; + asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000"); + asset.Data = pack.AssetBlock.AssetData; + + + } + /* for now we will only support uploading of textures + else if (pack.AssetBlock.Type == 13 | pack.AssetBlock.Type == 5) + { + + asset = new AssetBase(); + asset.FullID = assetID; + Console.WriteLine("skin asset id is " + assetID.ToStringHyphenated()); + asset.Type = pack.AssetBlock.Type; + asset.InvType = asset.Type; + asset.Name = "NewClothing" + Util.RandomClass.Next(1, 1000).ToString("000"); + asset.Data = pack.AssetBlock.AssetData; + + + }*/ + + if (asset != null) + { + this.AddUpload(pack.AssetBlock.TransactionID, asset); + } + else + { + + //currently we don't support this asset type + //so lets just tell the client that the upload is complete + AssetUploadCompletePacket response = new AssetUploadCompletePacket(); + response.AssetBlock.Type = pack.AssetBlock.Type; + response.AssetBlock.Success = true; + response.AssetBlock.UUID = pack.AssetBlock.TransactionID.Combine(this.ourClient.SecureSessionID); + this.ourClient.OutPacket(response); + } + + } + + #region Xfer packet system for larger uploads + + public void HandleXferPacket(SendXferPacketPacket xferPacket) + { + lock (this.transactions) + { + foreach (AssetTransaction trans in this.transactions.Values) + { + if (trans.XferID == xferPacket.XferID.ID) + { + if (trans.Asset.Data.Length > 1) + { + byte[] newArray = new byte[trans.Asset.Data.Length + xferPacket.DataPacket.Data.Length]; + Array.Copy(trans.Asset.Data, 0, newArray, 0, trans.Asset.Data.Length); + Array.Copy(xferPacket.DataPacket.Data, 0, newArray, trans.Asset.Data.Length, xferPacket.DataPacket.Data.Length); + trans.Asset.Data = newArray; + } + else + { + byte[] newArray = new byte[xferPacket.DataPacket.Data.Length-4]; + Array.Copy(xferPacket.DataPacket.Data, 4, newArray, 0, xferPacket.DataPacket.Data.Length-4); + trans.Asset.Data = newArray; + } + + if ((xferPacket.XferID.Packet & 2147483648) != 0) + { + //end of transfer + trans.UploadComplete = true; + AssetUploadCompletePacket response = new AssetUploadCompletePacket(); + response.AssetBlock.Type = trans.Asset.Type; + response.AssetBlock.Success = true; + response.AssetBlock.UUID = trans.TransactionID.Combine(this.ourClient.SecureSessionID); + this.ourClient.OutPacket(response); + + //check if we should add it to inventory + if (trans.AddToInventory) + { + OpenSimRoot.Instance.AssetCache.AddAsset(trans.Asset); + OpenSimRoot.Instance.InventoryCache.AddNewInventoryItem(this.ourClient, trans.InventFolder, trans.Asset); + } + + Console.WriteLine(Helpers.FieldToString(trans.Asset.Data)); + } + break; + } + + } + } + + ConfirmXferPacketPacket confirmXfer = new ConfirmXferPacketPacket(); + confirmXfer.XferID.ID = xferPacket.XferID.ID; + confirmXfer.XferID.Packet = xferPacket.XferID.Packet; + this.ourClient.OutPacket(confirmXfer); + } + + #endregion + + public void CreateInventoryItem(CreateInventoryItemPacket packet) + { + if(this.transactions.ContainsKey(packet.InventoryBlock.TransactionID)) + { + AssetTransaction trans = this.transactions[packet.InventoryBlock.TransactionID]; + trans.Asset.Description = Helpers.FieldToString(packet.InventoryBlock.Description); + trans.Asset.Name = Helpers.FieldToString(packet.InventoryBlock.Name); + trans.Asset.Type = packet.InventoryBlock.Type; + if (trans.UploadComplete) + { + //already complete so we can add it to the inventory + OpenSimRoot.Instance.AssetCache.AddAsset(trans.Asset); + OpenSimRoot.Instance.InventoryCache.AddNewInventoryItem(this.ourClient, packet.InventoryBlock.FolderID, trans.Asset); + } + else + { + trans.AddToInventory = true; + trans.InventFolder = packet.InventoryBlock.FolderID; + } + } + } + + } + + public class AssetTransaction + { + public uint XferID; + public AssetBase Asset; + public bool AddToInventory; + public LLUUID InventFolder = LLUUID.Zero; + public bool UploadComplete = false; + public LLUUID TransactionID = LLUUID.Zero; + + public AssetTransaction() + { + + } + } +} diff --git a/OpenSim.RegionServer/Assets/AssetCache.cs b/OpenSim.RegionServer/Assets/AssetCache.cs index 4149cb2..c1b3472 100644 --- a/OpenSim.RegionServer/Assets/AssetCache.cs +++ b/OpenSim.RegionServer/Assets/AssetCache.cs @@ -123,6 +123,36 @@ namespace OpenSim.Assets return inventorySet; } + public AssetBase GetAsset(LLUUID assetID) + { + AssetBase asset = null; + if(this.Textures.ContainsKey(assetID)) + { + asset = this.Textures[assetID]; + } + else if (this.Assets.ContainsKey(assetID)) + { + asset = this.Assets[assetID]; + } + return asset; + } + + public void AddAsset(AssetBase asset) + { + this._assetServer.UploadNewAsset(asset); + if (asset.Type == 0) + { + //texture + TextureImage textur = new TextureImage(asset); + this.Textures.Add(textur.FullID, textur); + } + else + { + AssetInfo assetInf = new AssetInfo(asset); + this.Assets.Add(assetInf.FullID, assetInf); + } + } + /// /// /// @@ -150,7 +180,7 @@ namespace OpenSim.Assets req = (AssetRequest)this.TextureRequests[i]; if (req.PacketCounter != req.NumPackets) { - + // if (req.ImageInfo.FullID == new LLUUID("00000000-0000-0000-5005-000000000005")) if (req.PacketCounter == 0) { //first time for this request so send imagedata packet @@ -186,7 +216,7 @@ namespace OpenSim.Assets } else { - //send imagepacket + //send imagepacket //more than one packet so split file up ImagePacketPacket im = new ImagePacketPacket(); im.ImageID.Packet = (ushort)req.PacketCounter; @@ -461,7 +491,6 @@ namespace OpenSim.Assets { req.NumPackets = 1; } - this.TextureRequests.Add(req); } @@ -477,50 +506,6 @@ namespace OpenSim.Assets } #endregion - #region viewer asset uploading - public AssetBase UploadPacket(AssetUploadRequestPacket pack, LLUUID assetID) - { - - AssetBase asset = null; - if (pack.AssetBlock.Type == 0) - { - if (pack.AssetBlock.AssetData.Length > 0) - { - //first packet for transaction - asset = new AssetBase(); - asset.FullID = assetID; - asset.Type = pack.AssetBlock.Type; - asset.InvType = asset.Type; - asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000"); - asset.Data = pack.AssetBlock.AssetData; - this._assetServer.UploadNewAsset(asset); - TextureImage image = new TextureImage(asset); - this.Textures.Add(image.FullID, image); - } - } - - return asset; - } - - /* - public AssetBase TransactionComplete(LLUUID transactionID) - { - AssetBase asset = null; - if(this.IncomingAssets.ContainsKey(transactionID)) - { - // not the first packet of this transaction - asset = this.IncomingAssets[transactionID]; - if(asset.Type == 0) - { - TextureImage image = new TextureImage(asset); - this.Textures.Add(image.FullID, image); - } - } - return asset; - }*/ - - #endregion - } public class AssetRequest diff --git a/OpenSim.RegionServer/Assets/InventoryCache.cs b/OpenSim.RegionServer/Assets/InventoryCache.cs index e4d0a90..9e73fe5 100644 --- a/OpenSim.RegionServer/Assets/InventoryCache.cs +++ b/OpenSim.RegionServer/Assets/InventoryCache.cs @@ -65,14 +65,20 @@ namespace OpenSim.Assets } } + public bool CreateNewInventoryFolder(SimClient remoteClient, LLUUID folderID) { + return this.CreateNewInventoryFolder(remoteClient, folderID, 0); + } + + public bool CreateNewInventoryFolder(SimClient remoteClient, LLUUID folderID, ushort type) + { bool res = false; if (folderID != LLUUID.Zero) //don't create a folder with a zero id { if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) { - res = this._agentsInventory[remoteClient.AgentID].CreateNewFolder(folderID); + res = this._agentsInventory[remoteClient.AgentID].CreateNewFolder(folderID, type); } } return res; @@ -94,6 +100,22 @@ namespace OpenSim.Assets return newItem; } + public bool UpdateInventoryItem(SimClient remoteClient, LLUUID itemID, OpenSim.Framework.Assets.AssetBase asset) + { + if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) + { + bool res = _agentsInventory[remoteClient.AgentID].UpdateItem(itemID, asset); + if (res) + { + InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[itemID]; + this.SendItemUpdateCreate(remoteClient, Item); + } + return res; + } + + return false; + } + public void FetchInventoryDescendents(SimClient userInfo, FetchInventoryDescendentsPacket FetchDescend) { if (this._agentsInventory.ContainsKey(userInfo.AgentID)) @@ -190,6 +212,7 @@ namespace OpenSim.Assets } } } + private void SendItemUpdateCreate(SimClient remoteClient, InventoryItem Item) { @@ -223,7 +246,7 @@ namespace OpenSim.Assets } } - + public class UserServerRequest { diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.csproj b/OpenSim.RegionServer/OpenSim.RegionServer.csproj index b191922..cc58347 100644 --- a/OpenSim.RegionServer/OpenSim.RegionServer.csproj +++ b/OpenSim.RegionServer/OpenSim.RegionServer.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,7 +6,8 @@ {457CE564-0922-4F15-846F-147E5BE62D67} Debug AnyCPU - + + OpenSim.RegionServer @@ -15,9 +16,11 @@ IE50 false Library - + + OpenSim.RegionServer - + + @@ -28,7 +31,8 @@ TRACE;DEBUG - + + True 4096 False @@ -37,7 +41,8 @@ False False 4 - + + False @@ -46,7 +51,8 @@ TRACE - + + False 4096 True @@ -55,26 +61,27 @@ False False 4 - + + - + System.dll False - + System.Xml.dll False - + ..\bin\libsecondlife.dll False - + ..\bin\Axiom.MathLib.dll False - + ..\bin\Db4objects.Db4o.dll False @@ -84,22 +91,23 @@ OpenSim.Framework.Console {CE124F22-69FC-4499-AE68-1B877C5898C4} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Physics.Manager {79C8C9A7-EF80-426D-B815-AC88E7998DFE} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework {71848571-2BC0-41DC-A69C-28B6DDB8C8CE} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False + Code @@ -177,4 +185,4 @@ - + \ No newline at end of file diff --git a/OpenSim.RegionServer/OpenSim.exe.build b/OpenSim.RegionServer/OpenSim.exe.build index 2b5e012..529f5fb 100644 --- a/OpenSim.RegionServer/OpenSim.exe.build +++ b/OpenSim.RegionServer/OpenSim.exe.build @@ -11,6 +11,7 @@ + diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs index d271ea9..9ae1baf 100644 --- a/OpenSim.RegionServer/SimClient.cs +++ b/OpenSim.RegionServer/SimClient.cs @@ -68,6 +68,7 @@ namespace OpenSim private const int MAX_APPENDED_ACKS = 10; private const int RESEND_TIMEOUT = 4000; private const int MAX_SEQUENCE = 0xFFFFFF; + private AgentAssetUpload UploadAssets; private LLUUID newAssetFolder = LLUUID.Zero; private bool debug = false; @@ -278,28 +279,37 @@ namespace OpenSim break; case PacketType.AssetUploadRequest: + //this.debug = true; AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; - AssetBase newAsset = OpenSimRoot.Instance.AssetCache.UploadPacket(request, LLUUID.Random()); - if ((newAsset != null) && (this.newAssetFolder != LLUUID.Zero)) + Console.WriteLine(Pack.ToString()); + if (request.AssetBlock.Type == 0) { - OpenSimRoot.Instance.InventoryCache.AddNewInventoryItem(this, this.newAssetFolder, newAsset); + this.UploadAssets.HandleUploadPacket(request, LLUUID.Random()); + } + else + { + this.UploadAssets.HandleUploadPacket(request, request.AssetBlock.TransactionID.Combine(this.SecureSessionID)); } - - AssetUploadCompletePacket response = new AssetUploadCompletePacket(); - response.AssetBlock.Type =request.AssetBlock.Type; - response.AssetBlock.Success = true; - response.AssetBlock.UUID = request.AssetBlock.TransactionID.Combine(this.SecureSessionID); - - this.OutPacket(response); + break; + case PacketType.SendXferPacket: + Console.WriteLine(Pack.ToString()); + this.UploadAssets.HandleXferPacket((SendXferPacketPacket)Pack); break; case PacketType.CreateInventoryFolder: - //Console.WriteLine(Pack.ToString()); + CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack; + OpenSimRoot.Instance.InventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type); + Console.WriteLine(Pack.ToString()); break; case PacketType.CreateInventoryItem: - //Console.WriteLine(Pack.ToString()); + Console.WriteLine(Pack.ToString()); + CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack; + if (createItem.InventoryBlock.TransactionID != LLUUID.Zero) + { + this.UploadAssets.CreateInventoryItem(createItem); + } break; case PacketType.FetchInventory: - Console.WriteLine("fetch item packet"); + //Console.WriteLine("fetch item packet"); FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack; OpenSimRoot.Instance.InventoryCache.FetchInventory(this, FetchInventory); break; @@ -307,6 +317,29 @@ namespace OpenSim FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack; OpenSimRoot.Instance.InventoryCache.FetchInventoryDescendents(this, Fetch); break; + case PacketType.UpdateInventoryItem: + /* UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack; + for (int i = 0; i < update.InventoryData.Length; i++) + { + if (update.InventoryData[i].TransactionID != LLUUID.Zero) + { + AssetBase asset = OpenSimRoot.Instance.AssetCache.GetAsset(update.InventoryData[i].TransactionID.Combine(this.SecureSessionID)); + OpenSimRoot.Instance.InventoryCache.UpdateInventoryItem(this, update.InventoryData[i].ItemID, asset); + } + }*/ + break; + case PacketType.ViewerEffect: + ViewerEffectPacket viewer = (ViewerEffectPacket)Pack; + foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) + { + if (client.AgentID != this.AgentID) + { + viewer.AgentData.AgentID = client.AgentID; + viewer.AgentData.SessionID = client.SessionID; + client.OutPacket(viewer); + } + } + break; case PacketType.DeRezObject: //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Received DeRezObject packet"); OpenSimRoot.Instance.LocalWorld.DeRezObject((DeRezObjectPacket)Pack, this); @@ -522,6 +555,8 @@ namespace OpenSim cirpack = initialcirpack; userEP = remoteEP; PacketQueue = new BlockingQueue(); + + this.UploadAssets = new AgentAssetUpload(this); AckTimer = new System.Timers.Timer(500); AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); AckTimer.Start(); diff --git a/OpenSim.sln b/OpenSim.sln index bd0abb1..88366cc 100644 --- a/OpenSim.sln +++ b/OpenSim.sln @@ -1,10 +1,10 @@ Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 +# Visual C# Express 2005 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Physics.PhysXPlugin", "OpenSim.Physics\PhysXPlugin\OpenSim.Physics.PhysXPlugin.csproj", "{62652FE9-20CC-4855-9D1C-6C1CCD706CC1}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Framework.Console", "OpenSim.Framework.Console\OpenSim.Framework.Console.csproj", "{CE124F22-69FC-4499-AE68-1B877C5898C4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Config.SimConfigDb4o", "OpenSim.Config\SimConfigDb4o\OpenSim.Config.SimConfigDb4o.csproj", "{C77FAE85-A786-4DEB-9AEB-46B75169079C}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Config.SimConfigDb4o", "OpenSim.Framework.Config\SimConfigDb4o\OpenSim.Config.SimConfigDb4o.csproj", "{C77FAE85-A786-4DEB-9AEB-46B75169079C}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Physics.BasicPhysicsPlugin", "OpenSim.Physics\BasicPhysicsPlugin\OpenSim.Physics.BasicPhysicsPlugin.csproj", "{0A4D5E28-88B6-474E-AC5F-3F99822DD976}" EndProject @@ -23,77 +23,57 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim", "OpenSim\OpenSim.csproj", "{778D384D-088A-42DF-A683-2244BD9530DE}" EndProject Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectDependencies) = postSolution - ({62652FE9-20CC-4855-9D1C-6C1CCD706CC1}).3 = ({79C8C9A7-EF80-426D-B815-AC88E7998DFE}) - ({C77FAE85-A786-4DEB-9AEB-46B75169079C}).5 = ({71848571-2BC0-41DC-A69C-28B6DDB8C8CE}) - ({C77FAE85-A786-4DEB-9AEB-46B75169079C}).6 = ({CE124F22-69FC-4499-AE68-1B877C5898C4}) - ({0A4D5E28-88B6-474E-AC5F-3F99822DD976}).2 = ({79C8C9A7-EF80-426D-B815-AC88E7998DFE}) - ({E0C662BD-1B64-4782-B8F2-9511255DB971}).3 = ({71848571-2BC0-41DC-A69C-28B6DDB8C8CE}) - ({E0C662BD-1B64-4782-B8F2-9511255DB971}).4 = ({CE124F22-69FC-4499-AE68-1B877C5898C4}) - ({455B4201-F942-48A1-ADE3-E38641ABB4D2}).4 = ({71848571-2BC0-41DC-A69C-28B6DDB8C8CE}) - ({455B4201-F942-48A1-ADE3-E38641ABB4D2}).5 = ({CE124F22-69FC-4499-AE68-1B877C5898C4}) - ({457CE564-0922-4F15-846F-147E5BE62D67}).5 = ({CE124F22-69FC-4499-AE68-1B877C5898C4}) - ({457CE564-0922-4F15-846F-147E5BE62D67}).6 = ({79C8C9A7-EF80-426D-B815-AC88E7998DFE}) - ({457CE564-0922-4F15-846F-147E5BE62D67}).7 = ({71848571-2BC0-41DC-A69C-28B6DDB8C8CE}) - ({79C8C9A7-EF80-426D-B815-AC88E7998DFE}).3 = ({CE124F22-69FC-4499-AE68-1B877C5898C4}) - ({5A852B3E-E770-4B00-A34B-1F8B4ABDA570}).4 = ({71848571-2BC0-41DC-A69C-28B6DDB8C8CE}) - ({5A852B3E-E770-4B00-A34B-1F8B4ABDA570}).5 = ({CE124F22-69FC-4499-AE68-1B877C5898C4}) - ({778D384D-088A-42DF-A683-2244BD9530DE}).5 = ({71848571-2BC0-41DC-A69C-28B6DDB8C8CE}) - ({778D384D-088A-42DF-A683-2244BD9530DE}).6 = ({CE124F22-69FC-4499-AE68-1B877C5898C4}) - ({778D384D-088A-42DF-A683-2244BD9530DE}).7 = ({79C8C9A7-EF80-426D-B815-AC88E7998DFE}) - ({778D384D-088A-42DF-A683-2244BD9530DE}).8 = ({457CE564-0922-4F15-846F-147E5BE62D67}) - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {62652FE9-20CC-4855-9D1C-6C1CCD706CC1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {62652FE9-20CC-4855-9D1C-6C1CCD706CC1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {62652FE9-20CC-4855-9D1C-6C1CCD706CC1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {62652FE9-20CC-4855-9D1C-6C1CCD706CC1}.Release|Any CPU.Build.0 = Release|Any CPU - {CE124F22-69FC-4499-AE68-1B877C5898C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CE124F22-69FC-4499-AE68-1B877C5898C4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CE124F22-69FC-4499-AE68-1B877C5898C4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CE124F22-69FC-4499-AE68-1B877C5898C4}.Release|Any CPU.Build.0 = Release|Any CPU - {C77FAE85-A786-4DEB-9AEB-46B75169079C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C77FAE85-A786-4DEB-9AEB-46B75169079C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C77FAE85-A786-4DEB-9AEB-46B75169079C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C77FAE85-A786-4DEB-9AEB-46B75169079C}.Release|Any CPU.Build.0 = Release|Any CPU - {0A4D5E28-88B6-474E-AC5F-3F99822DD976}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0A4D5E28-88B6-474E-AC5F-3F99822DD976}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0A4D5E28-88B6-474E-AC5F-3F99822DD976}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0A4D5E28-88B6-474E-AC5F-3F99822DD976}.Release|Any CPU.Build.0 = Release|Any CPU - {E0C662BD-1B64-4782-B8F2-9511255DB971}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E0C662BD-1B64-4782-B8F2-9511255DB971}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E0C662BD-1B64-4782-B8F2-9511255DB971}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E0C662BD-1B64-4782-B8F2-9511255DB971}.Release|Any CPU.Build.0 = Release|Any CPU - {455B4201-F942-48A1-ADE3-E38641ABB4D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {455B4201-F942-48A1-ADE3-E38641ABB4D2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {455B4201-F942-48A1-ADE3-E38641ABB4D2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {455B4201-F942-48A1-ADE3-E38641ABB4D2}.Release|Any CPU.Build.0 = Release|Any CPU - {71848571-2BC0-41DC-A69C-28B6DDB8C8CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {71848571-2BC0-41DC-A69C-28B6DDB8C8CE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {71848571-2BC0-41DC-A69C-28B6DDB8C8CE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {71848571-2BC0-41DC-A69C-28B6DDB8C8CE}.Release|Any CPU.Build.0 = Release|Any CPU - {457CE564-0922-4F15-846F-147E5BE62D67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {457CE564-0922-4F15-846F-147E5BE62D67}.Debug|Any CPU.Build.0 = Debug|Any CPU - {457CE564-0922-4F15-846F-147E5BE62D67}.Release|Any CPU.ActiveCfg = Release|Any CPU - {457CE564-0922-4F15-846F-147E5BE62D67}.Release|Any CPU.Build.0 = Release|Any CPU - {79C8C9A7-EF80-426D-B815-AC88E7998DFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {79C8C9A7-EF80-426D-B815-AC88E7998DFE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {79C8C9A7-EF80-426D-B815-AC88E7998DFE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {79C8C9A7-EF80-426D-B815-AC88E7998DFE}.Release|Any CPU.Build.0 = Release|Any CPU - {5A852B3E-E770-4B00-A34B-1F8B4ABDA570}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5A852B3E-E770-4B00-A34B-1F8B4ABDA570}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5A852B3E-E770-4B00-A34B-1F8B4ABDA570}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5A852B3E-E770-4B00-A34B-1F8B4ABDA570}.Release|Any CPU.Build.0 = Release|Any CPU - {778D384D-088A-42DF-A683-2244BD9530DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {778D384D-088A-42DF-A683-2244BD9530DE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {778D384D-088A-42DF-A683-2244BD9530DE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {778D384D-088A-42DF-A683-2244BD9530DE}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {62652FE9-20CC-4855-9D1C-6C1CCD706CC1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {62652FE9-20CC-4855-9D1C-6C1CCD706CC1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {62652FE9-20CC-4855-9D1C-6C1CCD706CC1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {62652FE9-20CC-4855-9D1C-6C1CCD706CC1}.Release|Any CPU.Build.0 = Release|Any CPU + {CE124F22-69FC-4499-AE68-1B877C5898C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CE124F22-69FC-4499-AE68-1B877C5898C4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CE124F22-69FC-4499-AE68-1B877C5898C4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CE124F22-69FC-4499-AE68-1B877C5898C4}.Release|Any CPU.Build.0 = Release|Any CPU + {C77FAE85-A786-4DEB-9AEB-46B75169079C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C77FAE85-A786-4DEB-9AEB-46B75169079C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C77FAE85-A786-4DEB-9AEB-46B75169079C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C77FAE85-A786-4DEB-9AEB-46B75169079C}.Release|Any CPU.Build.0 = Release|Any CPU + {0A4D5E28-88B6-474E-AC5F-3F99822DD976}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0A4D5E28-88B6-474E-AC5F-3F99822DD976}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0A4D5E28-88B6-474E-AC5F-3F99822DD976}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0A4D5E28-88B6-474E-AC5F-3F99822DD976}.Release|Any CPU.Build.0 = Release|Any CPU + {E0C662BD-1B64-4782-B8F2-9511255DB971}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E0C662BD-1B64-4782-B8F2-9511255DB971}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E0C662BD-1B64-4782-B8F2-9511255DB971}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E0C662BD-1B64-4782-B8F2-9511255DB971}.Release|Any CPU.Build.0 = Release|Any CPU + {455B4201-F942-48A1-ADE3-E38641ABB4D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {455B4201-F942-48A1-ADE3-E38641ABB4D2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {455B4201-F942-48A1-ADE3-E38641ABB4D2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {455B4201-F942-48A1-ADE3-E38641ABB4D2}.Release|Any CPU.Build.0 = Release|Any CPU + {71848571-2BC0-41DC-A69C-28B6DDB8C8CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {71848571-2BC0-41DC-A69C-28B6DDB8C8CE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {71848571-2BC0-41DC-A69C-28B6DDB8C8CE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {71848571-2BC0-41DC-A69C-28B6DDB8C8CE}.Release|Any CPU.Build.0 = Release|Any CPU + {457CE564-0922-4F15-846F-147E5BE62D67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {457CE564-0922-4F15-846F-147E5BE62D67}.Debug|Any CPU.Build.0 = Debug|Any CPU + {457CE564-0922-4F15-846F-147E5BE62D67}.Release|Any CPU.ActiveCfg = Release|Any CPU + {457CE564-0922-4F15-846F-147E5BE62D67}.Release|Any CPU.Build.0 = Release|Any CPU + {79C8C9A7-EF80-426D-B815-AC88E7998DFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {79C8C9A7-EF80-426D-B815-AC88E7998DFE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {79C8C9A7-EF80-426D-B815-AC88E7998DFE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {79C8C9A7-EF80-426D-B815-AC88E7998DFE}.Release|Any CPU.Build.0 = Release|Any CPU + {5A852B3E-E770-4B00-A34B-1F8B4ABDA570}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5A852B3E-E770-4B00-A34B-1F8B4ABDA570}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5A852B3E-E770-4B00-A34B-1F8B4ABDA570}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5A852B3E-E770-4B00-A34B-1F8B4ABDA570}.Release|Any CPU.Build.0 = Release|Any CPU + {778D384D-088A-42DF-A683-2244BD9530DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {778D384D-088A-42DF-A683-2244BD9530DE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {778D384D-088A-42DF-A683-2244BD9530DE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {778D384D-088A-42DF-A683-2244BD9530DE}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection EndGlobal -- cgit v1.1