aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer
diff options
context:
space:
mode:
authorMW2007-03-25 17:34:58 +0000
committerMW2007-03-25 17:34:58 +0000
commit40af8c256165eb6fb56f58e3c13ee9293e052f66 (patch)
treeadd744edd5c35ddc6de735cfab4ae39e944755d1 /OpenSim.RegionServer
parentAdding the only stuff that makes sense (diff)
downloadopensim-SC-40af8c256165eb6fb56f58e3c13ee9293e052f66.zip
opensim-SC-40af8c256165eb6fb56f58e3c13ee9293e052f66.tar.gz
opensim-SC-40af8c256165eb6fb56f58e3c13ee9293e052f66.tar.bz2
opensim-SC-40af8c256165eb6fb56f58e3c13ee9293e052f66.tar.xz
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
Diffstat (limited to 'OpenSim.RegionServer')
-rw-r--r--OpenSim.RegionServer/AgentAssetUpload.cs212
-rw-r--r--OpenSim.RegionServer/Assets/AssetCache.cs79
-rw-r--r--OpenSim.RegionServer/Assets/InventoryCache.cs27
-rw-r--r--OpenSim.RegionServer/OpenSim.RegionServer.csproj42
-rw-r--r--OpenSim.RegionServer/OpenSim.exe.build1
-rw-r--r--OpenSim.RegionServer/SimClient.cs61
6 files changed, 343 insertions, 79 deletions
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 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Framework.Assets;
5using OpenSim.Framework.Utilities;
6using libsecondlife;
7using libsecondlife.Packets;
8
9namespace OpenSim
10{
11 public class AgentAssetUpload
12 {
13 private Dictionary<LLUUID, AssetTransaction> transactions = new Dictionary<LLUUID, AssetTransaction>();
14 private SimClient ourClient;
15
16 public AgentAssetUpload(SimClient client)
17 {
18 this.ourClient = client;
19 }
20
21 public void AddUpload(LLUUID transactionID, AssetBase asset)
22 {
23 Console.WriteLine("adding upload asset");
24 AssetTransaction upload = new AssetTransaction();
25 lock (this.transactions)
26 {
27 upload.Asset = asset;
28 upload.TransactionID = transactionID;
29 this.transactions.Add(transactionID, upload);
30 }
31 if (upload.Asset.Data.Length > 2)
32 {
33 //is complete
34 upload.UploadComplete = true;
35 AssetUploadCompletePacket response = new AssetUploadCompletePacket();
36 response.AssetBlock.Type = asset.Type;
37 response.AssetBlock.Success = true;
38 response.AssetBlock.UUID = transactionID.Combine(this.ourClient.SecureSessionID);
39 this.ourClient.OutPacket(response);
40 }
41 else
42 {
43 Console.WriteLine(" no data in upload request so use xfer system");
44 upload.UploadComplete = false;
45 upload.XferID = Util.GetNextXferID();
46 RequestXferPacket xfer = new RequestXferPacket();
47 xfer.XferID.ID = upload.XferID;
48 xfer.XferID.VFileType = upload.Asset.Type;
49 xfer.XferID.VFileID = transactionID.Combine(this.ourClient.SecureSessionID);
50 xfer.XferID.FilePath = 0;
51 xfer.XferID.Filename = new byte[0];
52 this.ourClient.OutPacket(xfer);
53 }
54
55 }
56
57 public AssetBase GetUpload(LLUUID transactionID)
58 {
59 if (this.transactions.ContainsKey(transactionID))
60 {
61 return this.transactions[transactionID].Asset;
62 }
63
64 return null;
65 }
66
67 public void HandleUploadPacket(AssetUploadRequestPacket pack, LLUUID assetID)
68 {
69
70 AssetBase asset = null;
71 if (pack.AssetBlock.Type == 0)
72 {
73
74 //first packet for transaction
75 asset = new AssetBase();
76 asset.FullID = assetID;
77 asset.Type = pack.AssetBlock.Type;
78 asset.InvType = asset.Type;
79 asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000");
80 asset.Data = pack.AssetBlock.AssetData;
81
82
83 }
84 /* for now we will only support uploading of textures
85 else if (pack.AssetBlock.Type == 13 | pack.AssetBlock.Type == 5)
86 {
87
88 asset = new AssetBase();
89 asset.FullID = assetID;
90 Console.WriteLine("skin asset id is " + assetID.ToStringHyphenated());
91 asset.Type = pack.AssetBlock.Type;
92 asset.InvType = asset.Type;
93 asset.Name = "NewClothing" + Util.RandomClass.Next(1, 1000).ToString("000");
94 asset.Data = pack.AssetBlock.AssetData;
95
96
97 }*/
98
99 if (asset != null)
100 {
101 this.AddUpload(pack.AssetBlock.TransactionID, asset);
102 }
103 else
104 {
105
106 //currently we don't support this asset type
107 //so lets just tell the client that the upload is complete
108 AssetUploadCompletePacket response = new AssetUploadCompletePacket();
109 response.AssetBlock.Type = pack.AssetBlock.Type;
110 response.AssetBlock.Success = true;
111 response.AssetBlock.UUID = pack.AssetBlock.TransactionID.Combine(this.ourClient.SecureSessionID);
112 this.ourClient.OutPacket(response);
113 }
114
115 }
116
117 #region Xfer packet system for larger uploads
118
119 public void HandleXferPacket(SendXferPacketPacket xferPacket)
120 {
121 lock (this.transactions)
122 {
123 foreach (AssetTransaction trans in this.transactions.Values)
124 {
125 if (trans.XferID == xferPacket.XferID.ID)
126 {
127 if (trans.Asset.Data.Length > 1)
128 {
129 byte[] newArray = new byte[trans.Asset.Data.Length + xferPacket.DataPacket.Data.Length];
130 Array.Copy(trans.Asset.Data, 0, newArray, 0, trans.Asset.Data.Length);
131 Array.Copy(xferPacket.DataPacket.Data, 0, newArray, trans.Asset.Data.Length, xferPacket.DataPacket.Data.Length);
132 trans.Asset.Data = newArray;
133 }
134 else
135 {
136 byte[] newArray = new byte[xferPacket.DataPacket.Data.Length-4];
137 Array.Copy(xferPacket.DataPacket.Data, 4, newArray, 0, xferPacket.DataPacket.Data.Length-4);
138 trans.Asset.Data = newArray;
139 }
140
141 if ((xferPacket.XferID.Packet & 2147483648) != 0)
142 {
143 //end of transfer
144 trans.UploadComplete = true;
145 AssetUploadCompletePacket response = new AssetUploadCompletePacket();
146 response.AssetBlock.Type = trans.Asset.Type;
147 response.AssetBlock.Success = true;
148 response.AssetBlock.UUID = trans.TransactionID.Combine(this.ourClient.SecureSessionID);
149 this.ourClient.OutPacket(response);
150
151 //check if we should add it to inventory
152 if (trans.AddToInventory)
153 {
154 OpenSimRoot.Instance.AssetCache.AddAsset(trans.Asset);
155 OpenSimRoot.Instance.InventoryCache.AddNewInventoryItem(this.ourClient, trans.InventFolder, trans.Asset);
156 }
157
158 Console.WriteLine(Helpers.FieldToString(trans.Asset.Data));
159 }
160 break;
161 }
162
163 }
164 }
165
166 ConfirmXferPacketPacket confirmXfer = new ConfirmXferPacketPacket();
167 confirmXfer.XferID.ID = xferPacket.XferID.ID;
168 confirmXfer.XferID.Packet = xferPacket.XferID.Packet;
169 this.ourClient.OutPacket(confirmXfer);
170 }
171
172 #endregion
173
174 public void CreateInventoryItem(CreateInventoryItemPacket packet)
175 {
176 if(this.transactions.ContainsKey(packet.InventoryBlock.TransactionID))
177 {
178 AssetTransaction trans = this.transactions[packet.InventoryBlock.TransactionID];
179 trans.Asset.Description = Helpers.FieldToString(packet.InventoryBlock.Description);
180 trans.Asset.Name = Helpers.FieldToString(packet.InventoryBlock.Name);
181 trans.Asset.Type = packet.InventoryBlock.Type;
182 if (trans.UploadComplete)
183 {
184 //already complete so we can add it to the inventory
185 OpenSimRoot.Instance.AssetCache.AddAsset(trans.Asset);
186 OpenSimRoot.Instance.InventoryCache.AddNewInventoryItem(this.ourClient, packet.InventoryBlock.FolderID, trans.Asset);
187 }
188 else
189 {
190 trans.AddToInventory = true;
191 trans.InventFolder = packet.InventoryBlock.FolderID;
192 }
193 }
194 }
195
196 }
197
198 public class AssetTransaction
199 {
200 public uint XferID;
201 public AssetBase Asset;
202 public bool AddToInventory;
203 public LLUUID InventFolder = LLUUID.Zero;
204 public bool UploadComplete = false;
205 public LLUUID TransactionID = LLUUID.Zero;
206
207 public AssetTransaction()
208 {
209
210 }
211 }
212}
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
123 return inventorySet; 123 return inventorySet;
124 } 124 }
125 125
126 public AssetBase GetAsset(LLUUID assetID)
127 {
128 AssetBase asset = null;
129 if(this.Textures.ContainsKey(assetID))
130 {
131 asset = this.Textures[assetID];
132 }
133 else if (this.Assets.ContainsKey(assetID))
134 {
135 asset = this.Assets[assetID];
136 }
137 return asset;
138 }
139
140 public void AddAsset(AssetBase asset)
141 {
142 this._assetServer.UploadNewAsset(asset);
143 if (asset.Type == 0)
144 {
145 //texture
146 TextureImage textur = new TextureImage(asset);
147 this.Textures.Add(textur.FullID, textur);
148 }
149 else
150 {
151 AssetInfo assetInf = new AssetInfo(asset);
152 this.Assets.Add(assetInf.FullID, assetInf);
153 }
154 }
155
126 /// <summary> 156 /// <summary>
127 /// 157 ///
128 /// </summary> 158 /// </summary>
@@ -150,7 +180,7 @@ namespace OpenSim.Assets
150 req = (AssetRequest)this.TextureRequests[i]; 180 req = (AssetRequest)this.TextureRequests[i];
151 if (req.PacketCounter != req.NumPackets) 181 if (req.PacketCounter != req.NumPackets)
152 { 182 {
153 183 // if (req.ImageInfo.FullID == new LLUUID("00000000-0000-0000-5005-000000000005"))
154 if (req.PacketCounter == 0) 184 if (req.PacketCounter == 0)
155 { 185 {
156 //first time for this request so send imagedata packet 186 //first time for this request so send imagedata packet
@@ -186,7 +216,7 @@ namespace OpenSim.Assets
186 } 216 }
187 else 217 else
188 { 218 {
189 //send imagepacket 219 //send imagepacket
190 //more than one packet so split file up 220 //more than one packet so split file up
191 ImagePacketPacket im = new ImagePacketPacket(); 221 ImagePacketPacket im = new ImagePacketPacket();
192 im.ImageID.Packet = (ushort)req.PacketCounter; 222 im.ImageID.Packet = (ushort)req.PacketCounter;
@@ -461,7 +491,6 @@ namespace OpenSim.Assets
461 { 491 {
462 req.NumPackets = 1; 492 req.NumPackets = 1;
463 } 493 }
464
465 this.TextureRequests.Add(req); 494 this.TextureRequests.Add(req);
466 } 495 }
467 496
@@ -477,50 +506,6 @@ namespace OpenSim.Assets
477 } 506 }
478 #endregion 507 #endregion
479 508
480 #region viewer asset uploading
481 public AssetBase UploadPacket(AssetUploadRequestPacket pack, LLUUID assetID)
482 {
483
484 AssetBase asset = null;
485 if (pack.AssetBlock.Type == 0)
486 {
487 if (pack.AssetBlock.AssetData.Length > 0)
488 {
489 //first packet for transaction
490 asset = new AssetBase();
491 asset.FullID = assetID;
492 asset.Type = pack.AssetBlock.Type;
493 asset.InvType = asset.Type;
494 asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000");
495 asset.Data = pack.AssetBlock.AssetData;
496 this._assetServer.UploadNewAsset(asset);
497 TextureImage image = new TextureImage(asset);
498 this.Textures.Add(image.FullID, image);
499 }
500 }
501
502 return asset;
503 }
504
505 /*
506 public AssetBase TransactionComplete(LLUUID transactionID)
507 {
508 AssetBase asset = null;
509 if(this.IncomingAssets.ContainsKey(transactionID))
510 {
511 // not the first packet of this transaction
512 asset = this.IncomingAssets[transactionID];
513 if(asset.Type == 0)
514 {
515 TextureImage image = new TextureImage(asset);
516 this.Textures.Add(image.FullID, image);
517 }
518 }
519 return asset;
520 }*/
521
522 #endregion
523
524 } 509 }
525 510
526 public class AssetRequest 511 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
65 } 65 }
66 66
67 } 67 }
68
68 public bool CreateNewInventoryFolder(SimClient remoteClient, LLUUID folderID) 69 public bool CreateNewInventoryFolder(SimClient remoteClient, LLUUID folderID)
69 { 70 {
71 return this.CreateNewInventoryFolder(remoteClient, folderID, 0);
72 }
73
74 public bool CreateNewInventoryFolder(SimClient remoteClient, LLUUID folderID, ushort type)
75 {
70 bool res = false; 76 bool res = false;
71 if (folderID != LLUUID.Zero) //don't create a folder with a zero id 77 if (folderID != LLUUID.Zero) //don't create a folder with a zero id
72 { 78 {
73 if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) 79 if (this._agentsInventory.ContainsKey(remoteClient.AgentID))
74 { 80 {
75 res = this._agentsInventory[remoteClient.AgentID].CreateNewFolder(folderID); 81 res = this._agentsInventory[remoteClient.AgentID].CreateNewFolder(folderID, type);
76 } 82 }
77 } 83 }
78 return res; 84 return res;
@@ -94,6 +100,22 @@ namespace OpenSim.Assets
94 return newItem; 100 return newItem;
95 } 101 }
96 102
103 public bool UpdateInventoryItem(SimClient remoteClient, LLUUID itemID, OpenSim.Framework.Assets.AssetBase asset)
104 {
105 if (this._agentsInventory.ContainsKey(remoteClient.AgentID))
106 {
107 bool res = _agentsInventory[remoteClient.AgentID].UpdateItem(itemID, asset);
108 if (res)
109 {
110 InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[itemID];
111 this.SendItemUpdateCreate(remoteClient, Item);
112 }
113 return res;
114 }
115
116 return false;
117 }
118
97 public void FetchInventoryDescendents(SimClient userInfo, FetchInventoryDescendentsPacket FetchDescend) 119 public void FetchInventoryDescendents(SimClient userInfo, FetchInventoryDescendentsPacket FetchDescend)
98 { 120 {
99 if (this._agentsInventory.ContainsKey(userInfo.AgentID)) 121 if (this._agentsInventory.ContainsKey(userInfo.AgentID))
@@ -190,6 +212,7 @@ namespace OpenSim.Assets
190 } 212 }
191 } 213 }
192 } 214 }
215
193 private void SendItemUpdateCreate(SimClient remoteClient, InventoryItem Item) 216 private void SendItemUpdateCreate(SimClient remoteClient, InventoryItem Item)
194 { 217 {
195 218
@@ -223,7 +246,7 @@ namespace OpenSim.Assets
223 } 246 }
224 } 247 }
225 248
226 249
227 250
228 public class UserServerRequest 251 public class UserServerRequest
229 { 252 {
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 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup> 2 <PropertyGroup>
3 <ProjectType>Local</ProjectType> 3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion> 4 <ProductVersion>8.0.50727</ProductVersion>
@@ -6,7 +6,8 @@
6 <ProjectGuid>{457CE564-0922-4F15-846F-147E5BE62D67}</ProjectGuid> 6 <ProjectGuid>{457CE564-0922-4F15-846F-147E5BE62D67}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon> 9 <ApplicationIcon>
10 </ApplicationIcon>
10 <AssemblyKeyContainerName> 11 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName> 12 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.RegionServer</AssemblyName> 13 <AssemblyName>OpenSim.RegionServer</AssemblyName>
@@ -15,9 +16,11 @@
15 <DefaultTargetSchema>IE50</DefaultTargetSchema> 16 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign> 17 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType> 18 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder> 19 <AppDesignerFolder>
20 </AppDesignerFolder>
19 <RootNamespace>OpenSim.RegionServer</RootNamespace> 21 <RootNamespace>OpenSim.RegionServer</RootNamespace>
20 <StartupObject></StartupObject> 22 <StartupObject>
23 </StartupObject>
21 <FileUpgradeFlags> 24 <FileUpgradeFlags>
22 </FileUpgradeFlags> 25 </FileUpgradeFlags>
23 </PropertyGroup> 26 </PropertyGroup>
@@ -28,7 +31,8 @@
28 <ConfigurationOverrideFile> 31 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile> 32 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants> 33 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile> 34 <DocumentationFile>
35 </DocumentationFile>
32 <DebugSymbols>True</DebugSymbols> 36 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment> 37 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize> 38 <Optimize>False</Optimize>
@@ -37,7 +41,8 @@
37 <RemoveIntegerChecks>False</RemoveIntegerChecks> 41 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 42 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel> 43 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn> 44 <NoWarn>
45 </NoWarn>
41 </PropertyGroup> 46 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 47 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks> 48 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
@@ -46,7 +51,8 @@
46 <ConfigurationOverrideFile> 51 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile> 52 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants> 53 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile> 54 <DocumentationFile>
55 </DocumentationFile>
50 <DebugSymbols>False</DebugSymbols> 56 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment> 57 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize> 58 <Optimize>True</Optimize>
@@ -55,26 +61,27 @@
55 <RemoveIntegerChecks>False</RemoveIntegerChecks> 61 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 62 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel> 63 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn> 64 <NoWarn>
65 </NoWarn>
59 </PropertyGroup> 66 </PropertyGroup>
60 <ItemGroup> 67 <ItemGroup>
61 <Reference Include="System" > 68 <Reference Include="System">
62 <HintPath>System.dll</HintPath> 69 <HintPath>System.dll</HintPath>
63 <Private>False</Private> 70 <Private>False</Private>
64 </Reference> 71 </Reference>
65 <Reference Include="System.Xml" > 72 <Reference Include="System.Xml">
66 <HintPath>System.Xml.dll</HintPath> 73 <HintPath>System.Xml.dll</HintPath>
67 <Private>False</Private> 74 <Private>False</Private>
68 </Reference> 75 </Reference>
69 <Reference Include="libsecondlife.dll" > 76 <Reference Include="libsecondlife.dll">
70 <HintPath>..\bin\libsecondlife.dll</HintPath> 77 <HintPath>..\bin\libsecondlife.dll</HintPath>
71 <Private>False</Private> 78 <Private>False</Private>
72 </Reference> 79 </Reference>
73 <Reference Include="Axiom.MathLib.dll" > 80 <Reference Include="Axiom.MathLib.dll">
74 <HintPath>..\bin\Axiom.MathLib.dll</HintPath> 81 <HintPath>..\bin\Axiom.MathLib.dll</HintPath>
75 <Private>False</Private> 82 <Private>False</Private>
76 </Reference> 83 </Reference>
77 <Reference Include="Db4objects.Db4o.dll" > 84 <Reference Include="Db4objects.Db4o.dll">
78 <HintPath>..\bin\Db4objects.Db4o.dll</HintPath> 85 <HintPath>..\bin\Db4objects.Db4o.dll</HintPath>
79 <Private>False</Private> 86 <Private>False</Private>
80 </Reference> 87 </Reference>
@@ -84,22 +91,23 @@
84 <Name>OpenSim.Framework.Console</Name> 91 <Name>OpenSim.Framework.Console</Name>
85 <Project>{CE124F22-69FC-4499-AE68-1B877C5898C4}</Project> 92 <Project>{CE124F22-69FC-4499-AE68-1B877C5898C4}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 93 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private> 94 <Private>False</Private>
88 </ProjectReference> 95 </ProjectReference>
89 <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj"> 96 <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj">
90 <Name>OpenSim.Physics.Manager</Name> 97 <Name>OpenSim.Physics.Manager</Name>
91 <Project>{79C8C9A7-EF80-426D-B815-AC88E7998DFE}</Project> 98 <Project>{79C8C9A7-EF80-426D-B815-AC88E7998DFE}</Project>
92 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 99 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
93 <Private>False</Private> 100 <Private>False</Private>
94 </ProjectReference> 101 </ProjectReference>
95 <ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj"> 102 <ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj">
96 <Name>OpenSim.Framework</Name> 103 <Name>OpenSim.Framework</Name>
97 <Project>{71848571-2BC0-41DC-A69C-28B6DDB8C8CE}</Project> 104 <Project>{71848571-2BC0-41DC-A69C-28B6DDB8C8CE}</Project>
98 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 105 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
99 <Private>False</Private> 106 <Private>False</Private>
100 </ProjectReference> 107 </ProjectReference>
101 </ItemGroup> 108 </ItemGroup>
102 <ItemGroup> 109 <ItemGroup>
110 <Compile Include="AgentAssetUpload.cs" />
103 <Compile Include="Grid.cs"> 111 <Compile Include="Grid.cs">
104 <SubType>Code</SubType> 112 <SubType>Code</SubType>
105 </Compile> 113 </Compile>
@@ -177,4 +185,4 @@
177 <PostBuildEvent> 185 <PostBuildEvent>
178 </PostBuildEvent> 186 </PostBuildEvent>
179 </PropertyGroup> 187 </PropertyGroup>
180</Project> 188</Project> \ 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 @@
11 <resources prefix="OpenSim" dynamicprefix="true" > 11 <resources prefix="OpenSim" dynamicprefix="true" >
12 </resources> 12 </resources>
13 <sources failonempty="true"> 13 <sources failonempty="true">
14 <include name="AgentAssetUpload.cs" />
14 <include name="Grid.cs" /> 15 <include name="Grid.cs" />
15 <include name="OpenSimApplication.cs" /> 16 <include name="OpenSimApplication.cs" />
16 <include name="OpenSimMain.cs" /> 17 <include name="OpenSimMain.cs" />
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
68 private const int MAX_APPENDED_ACKS = 10; 68 private const int MAX_APPENDED_ACKS = 10;
69 private const int RESEND_TIMEOUT = 4000; 69 private const int RESEND_TIMEOUT = 4000;
70 private const int MAX_SEQUENCE = 0xFFFFFF; 70 private const int MAX_SEQUENCE = 0xFFFFFF;
71 private AgentAssetUpload UploadAssets;
71 private LLUUID newAssetFolder = LLUUID.Zero; 72 private LLUUID newAssetFolder = LLUUID.Zero;
72 private bool debug = false; 73 private bool debug = false;
73 74
@@ -278,28 +279,37 @@ namespace OpenSim
278 279
279 break; 280 break;
280 case PacketType.AssetUploadRequest: 281 case PacketType.AssetUploadRequest:
282 //this.debug = true;
281 AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; 283 AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack;
282 AssetBase newAsset = OpenSimRoot.Instance.AssetCache.UploadPacket(request, LLUUID.Random()); 284 Console.WriteLine(Pack.ToString());
283 if ((newAsset != null) && (this.newAssetFolder != LLUUID.Zero)) 285 if (request.AssetBlock.Type == 0)
284 { 286 {
285 OpenSimRoot.Instance.InventoryCache.AddNewInventoryItem(this, this.newAssetFolder, newAsset); 287 this.UploadAssets.HandleUploadPacket(request, LLUUID.Random());
288 }
289 else
290 {
291 this.UploadAssets.HandleUploadPacket(request, request.AssetBlock.TransactionID.Combine(this.SecureSessionID));
286 } 292 }
287 293 break;
288 AssetUploadCompletePacket response = new AssetUploadCompletePacket(); 294 case PacketType.SendXferPacket:
289 response.AssetBlock.Type =request.AssetBlock.Type; 295 Console.WriteLine(Pack.ToString());
290 response.AssetBlock.Success = true; 296 this.UploadAssets.HandleXferPacket((SendXferPacketPacket)Pack);
291 response.AssetBlock.UUID = request.AssetBlock.TransactionID.Combine(this.SecureSessionID);
292
293 this.OutPacket(response);
294 break; 297 break;
295 case PacketType.CreateInventoryFolder: 298 case PacketType.CreateInventoryFolder:
296 //Console.WriteLine(Pack.ToString()); 299 CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack;
300 OpenSimRoot.Instance.InventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type);
301 Console.WriteLine(Pack.ToString());
297 break; 302 break;
298 case PacketType.CreateInventoryItem: 303 case PacketType.CreateInventoryItem:
299 //Console.WriteLine(Pack.ToString()); 304 Console.WriteLine(Pack.ToString());
305 CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack;
306 if (createItem.InventoryBlock.TransactionID != LLUUID.Zero)
307 {
308 this.UploadAssets.CreateInventoryItem(createItem);
309 }
300 break; 310 break;
301 case PacketType.FetchInventory: 311 case PacketType.FetchInventory:
302 Console.WriteLine("fetch item packet"); 312 //Console.WriteLine("fetch item packet");
303 FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack; 313 FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack;
304 OpenSimRoot.Instance.InventoryCache.FetchInventory(this, FetchInventory); 314 OpenSimRoot.Instance.InventoryCache.FetchInventory(this, FetchInventory);
305 break; 315 break;
@@ -307,6 +317,29 @@ namespace OpenSim
307 FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack; 317 FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack;
308 OpenSimRoot.Instance.InventoryCache.FetchInventoryDescendents(this, Fetch); 318 OpenSimRoot.Instance.InventoryCache.FetchInventoryDescendents(this, Fetch);
309 break; 319 break;
320 case PacketType.UpdateInventoryItem:
321 /* UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack;
322 for (int i = 0; i < update.InventoryData.Length; i++)
323 {
324 if (update.InventoryData[i].TransactionID != LLUUID.Zero)
325 {
326 AssetBase asset = OpenSimRoot.Instance.AssetCache.GetAsset(update.InventoryData[i].TransactionID.Combine(this.SecureSessionID));
327 OpenSimRoot.Instance.InventoryCache.UpdateInventoryItem(this, update.InventoryData[i].ItemID, asset);
328 }
329 }*/
330 break;
331 case PacketType.ViewerEffect:
332 ViewerEffectPacket viewer = (ViewerEffectPacket)Pack;
333 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values)
334 {
335 if (client.AgentID != this.AgentID)
336 {
337 viewer.AgentData.AgentID = client.AgentID;
338 viewer.AgentData.SessionID = client.SessionID;
339 client.OutPacket(viewer);
340 }
341 }
342 break;
310 case PacketType.DeRezObject: 343 case PacketType.DeRezObject:
311 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Received DeRezObject packet"); 344 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Received DeRezObject packet");
312 OpenSimRoot.Instance.LocalWorld.DeRezObject((DeRezObjectPacket)Pack, this); 345 OpenSimRoot.Instance.LocalWorld.DeRezObject((DeRezObjectPacket)Pack, this);
@@ -522,6 +555,8 @@ namespace OpenSim
522 cirpack = initialcirpack; 555 cirpack = initialcirpack;
523 userEP = remoteEP; 556 userEP = remoteEP;
524 PacketQueue = new BlockingQueue<QueItem>(); 557 PacketQueue = new BlockingQueue<QueItem>();
558
559 this.UploadAssets = new AgentAssetUpload(this);
525 AckTimer = new System.Timers.Timer(500); 560 AckTimer = new System.Timers.Timer(500);
526 AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); 561 AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed);
527 AckTimer.Start(); 562 AckTimer.Start();