aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs1
-rw-r--r--OpenSim/Region/ClientStack/Assets/InventoryCache.cs317
-rw-r--r--OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs11
-rw-r--r--OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs4
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs11
-rw-r--r--OpenSim/Region/ClientStack/PacketServer.cs9
-rw-r--r--OpenSim/Region/ClientStack/RegionApplicationBase.cs25
-rw-r--r--OpenSim/Region/ClientStack/UDPServer.cs7
-rw-r--r--OpenSim/Region/Examples/SimpleApp/Program.cs1
9 files changed, 28 insertions, 358 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index 0114cc6..71fa2c0 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -30,7 +30,6 @@ using System;
30using System.IO; 30using System.IO;
31using libsecondlife; 31using libsecondlife;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Assets;
34using OpenSim.Framework; 33using OpenSim.Framework;
35using OpenSim.Framework.Communications; 34using OpenSim.Framework.Communications;
36using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
diff --git a/OpenSim/Region/ClientStack/Assets/InventoryCache.cs b/OpenSim/Region/ClientStack/Assets/InventoryCache.cs
deleted file mode 100644
index 8185502..0000000
--- a/OpenSim/Region/ClientStack/Assets/InventoryCache.cs
+++ /dev/null
@@ -1,317 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using libsecondlife;
33using libsecondlife.Packets;
34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Inventory;
36using OpenSim.Framework.Types;
37using OpenSim.Region.ClientStack;
38using InventoryFolder = OpenSim.Framework.Inventory.InventoryFolder;
39using InventoryItem = OpenSim.Framework.Inventory.InventoryItem;
40
41namespace OpenSim.Assets
42{
43 /// <summary>
44 /// Description of InventoryManager.
45 /// </summary>
46 public class InventoryCache
47 {
48 private Dictionary<LLUUID, AgentInventory> _agentsInventory;
49 private List<UserServerRequest> _serverRequests; //list of requests made to user server.
50 private Encoding _enc = Encoding.ASCII;
51 private const uint FULL_MASK_PERMISSIONS = 2147483647;
52
53 public InventoryCache()
54 {
55 _agentsInventory = new Dictionary<LLUUID, AgentInventory>();
56 _serverRequests = new List<UserServerRequest>();
57 }
58
59 public void AddNewAgentsInventory(AgentInventory agentInventory)
60 {
61 if (!this._agentsInventory.ContainsKey(agentInventory.AgentID))
62 {
63 this._agentsInventory.Add(agentInventory.AgentID, agentInventory);
64 }
65 }
66
67 public AgentInventory GetAgentsInventory(LLUUID agentID)
68 {
69 if (this._agentsInventory.ContainsKey(agentID))
70 {
71 return this._agentsInventory[agentID];
72 }
73
74 return null;
75 }
76
77 public bool CreateNewInventoryFolder(ClientView remoteClient, LLUUID folderID)
78 {
79 return this.CreateNewInventoryFolder(remoteClient, folderID, 0);
80 }
81
82 public bool CreateNewInventoryFolder(ClientView remoteClient, LLUUID folderID, ushort type)
83 {
84 bool res = false;
85 if (folderID != LLUUID.Zero) //don't create a folder with a zero id
86 {
87 if (this._agentsInventory.ContainsKey(remoteClient.AgentID))
88 {
89 res = this._agentsInventory[remoteClient.AgentID].CreateNewFolder(folderID, type);
90 }
91 }
92 return res;
93 }
94
95 public bool CreateNewInventoryFolder(ClientView remoteClient, LLUUID folderID, ushort type, string folderName, LLUUID parent)
96 {
97 bool res = false;
98 if (folderID != LLUUID.Zero) //don't create a folder with a zero id
99 {
100 if (this._agentsInventory.ContainsKey(remoteClient.AgentID))
101 {
102 res = this._agentsInventory[remoteClient.AgentID].CreateNewFolder(folderID, type, folderName, parent);
103 }
104 }
105 return res;
106 }
107
108 public LLUUID AddNewInventoryItem(ClientView remoteClient, LLUUID folderID, AssetBase asset)
109 {
110 LLUUID newItem = null;
111 if (this._agentsInventory.ContainsKey(remoteClient.AgentID))
112 {
113 newItem = this._agentsInventory[remoteClient.AgentID].AddToInventory(folderID, asset);
114 if (newItem != null)
115 {
116 InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[newItem];
117 this.SendItemUpdateCreate(remoteClient, Item);
118 }
119 }
120
121 return newItem;
122 }
123 public bool DeleteInventoryItem(ClientView remoteClient, LLUUID itemID)
124 {
125 bool res = false;
126 if (this._agentsInventory.ContainsKey(remoteClient.AgentID))
127 {
128 res = this._agentsInventory[remoteClient.AgentID].DeleteFromInventory(itemID);
129 if (res)
130 {
131 RemoveInventoryItemPacket remove = new RemoveInventoryItemPacket();
132 remove.AgentData.AgentID = remoteClient.AgentID;
133 remove.AgentData.SessionID = remoteClient.SessionID;
134 remove.InventoryData = new RemoveInventoryItemPacket.InventoryDataBlock[1];
135 remove.InventoryData[0] = new RemoveInventoryItemPacket.InventoryDataBlock();
136 remove.InventoryData[0].ItemID = itemID;
137 remoteClient.OutPacket(remove);
138 }
139 }
140
141 return res;
142 }
143
144 public bool UpdateInventoryItemAsset(ClientView remoteClient, LLUUID itemID, AssetBase asset)
145 {
146 if (this._agentsInventory.ContainsKey(remoteClient.AgentID))
147 {
148 bool res = _agentsInventory[remoteClient.AgentID].UpdateItemAsset(itemID, asset);
149 if (res)
150 {
151 InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[itemID];
152 this.SendItemUpdateCreate(remoteClient, Item);
153 }
154 return res;
155 }
156
157 return false;
158 }
159
160 public bool UpdateInventoryItemDetails(ClientView remoteClient, LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet)
161 {
162 if (this._agentsInventory.ContainsKey(remoteClient.AgentID))
163 {
164 bool res = _agentsInventory[remoteClient.AgentID].UpdateItemDetails(itemID, packet);
165 if (res)
166 {
167 InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[itemID];
168 this.SendItemUpdateCreate(remoteClient, Item);
169 }
170 return res;
171 }
172
173 return false;
174 }
175
176 public void FetchInventoryDescendents(ClientView userInfo, FetchInventoryDescendentsPacket FetchDescend)
177 {
178
179 if (this._agentsInventory.ContainsKey(userInfo.AgentID))
180 {
181 AgentInventory agentInventory = this._agentsInventory[userInfo.AgentID];
182 if (FetchDescend.InventoryData.FetchItems)
183 {
184 if (agentInventory.InventoryFolders.ContainsKey(FetchDescend.InventoryData.FolderID))
185 {
186 InventoryFolder Folder = agentInventory.InventoryFolders[FetchDescend.InventoryData.FolderID];
187 InventoryDescendentsPacket Descend = new InventoryDescendentsPacket();
188 Descend.AgentData.AgentID = userInfo.AgentID;
189 Descend.AgentData.OwnerID = Folder.OwnerID;
190 Descend.AgentData.FolderID = FetchDescend.InventoryData.FolderID;
191 Descend.AgentData.Descendents = Folder.Items.Count;
192 Descend.AgentData.Version = Folder.Items.Count;
193
194
195 Descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[Folder.Items.Count];
196 for (int i = 0; i < Folder.Items.Count; i++)
197 {
198
199 InventoryItem Item = Folder.Items[i];
200 Descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock();
201 Descend.ItemData[i].ItemID = Item.ItemID;
202 Descend.ItemData[i].AssetID = Item.AssetID;
203 Descend.ItemData[i].CreatorID = Item.CreatorID;
204 Descend.ItemData[i].BaseMask = FULL_MASK_PERMISSIONS;
205 Descend.ItemData[i].CreationDate = 1000;
206 Descend.ItemData[i].Description = _enc.GetBytes(Item.Description + "\0");
207 Descend.ItemData[i].EveryoneMask = FULL_MASK_PERMISSIONS;
208 Descend.ItemData[i].Flags = 1;
209 Descend.ItemData[i].FolderID = Item.FolderID;
210 Descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
211 Descend.ItemData[i].GroupMask = FULL_MASK_PERMISSIONS;
212 Descend.ItemData[i].InvType = Item.InvType;
213 Descend.ItemData[i].Name = _enc.GetBytes(Item.Name + "\0");
214 Descend.ItemData[i].NextOwnerMask = FULL_MASK_PERMISSIONS;
215 Descend.ItemData[i].OwnerID = Item.OwnerID;
216 Descend.ItemData[i].OwnerMask = FULL_MASK_PERMISSIONS;
217 Descend.ItemData[i].SalePrice = 100;
218 Descend.ItemData[i].SaleType = 0;
219 Descend.ItemData[i].Type = Item.Type;
220 Descend.ItemData[i].CRC = Helpers.InventoryCRC(1000, 0, Descend.ItemData[i].InvType, Descend.ItemData[i].Type, Descend.ItemData[i].AssetID, Descend.ItemData[i].GroupID, 100, Descend.ItemData[i].OwnerID, Descend.ItemData[i].CreatorID, Descend.ItemData[i].ItemID, Descend.ItemData[i].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS);
221 }
222
223 userInfo.OutPacket(Descend);
224
225 }
226 }
227 else
228 {
229 Console.WriteLine("fetch subfolders");
230 }
231 }
232 }
233
234 public void FetchInventory(ClientView userInfo, FetchInventoryPacket FetchItems)
235 {
236 if (this._agentsInventory.ContainsKey(userInfo.AgentID))
237 {
238 AgentInventory agentInventory = this._agentsInventory[userInfo.AgentID];
239
240 for (int i = 0; i < FetchItems.InventoryData.Length; i++)
241 {
242 if (agentInventory.InventoryItems.ContainsKey(FetchItems.InventoryData[i].ItemID))
243 {
244 InventoryItem Item = agentInventory.InventoryItems[FetchItems.InventoryData[i].ItemID];
245 FetchInventoryReplyPacket InventoryReply = new FetchInventoryReplyPacket();
246 InventoryReply.AgentData.AgentID = userInfo.AgentID;
247 InventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1];
248 InventoryReply.InventoryData[0] = new FetchInventoryReplyPacket.InventoryDataBlock();
249 InventoryReply.InventoryData[0].ItemID = Item.ItemID;
250 InventoryReply.InventoryData[0].AssetID = Item.AssetID;
251 InventoryReply.InventoryData[0].CreatorID = Item.CreatorID;
252 InventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS;
253 InventoryReply.InventoryData[0].CreationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
254 InventoryReply.InventoryData[0].Description = _enc.GetBytes(Item.Description + "\0");
255 InventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS;
256 InventoryReply.InventoryData[0].Flags = 0;
257 InventoryReply.InventoryData[0].FolderID = Item.FolderID;
258 InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
259 InventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS;
260 InventoryReply.InventoryData[0].InvType = Item.InvType;
261 InventoryReply.InventoryData[0].Name = _enc.GetBytes(Item.Name + "\0");
262 InventoryReply.InventoryData[0].NextOwnerMask = FULL_MASK_PERMISSIONS;
263 InventoryReply.InventoryData[0].OwnerID = Item.OwnerID;
264 InventoryReply.InventoryData[0].OwnerMask = FULL_MASK_PERMISSIONS;
265 InventoryReply.InventoryData[0].SalePrice = 100;
266 InventoryReply.InventoryData[0].SaleType = 0;
267 InventoryReply.InventoryData[0].Type = Item.Type;
268 InventoryReply.InventoryData[0].CRC = Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS);
269 userInfo.OutPacket(InventoryReply);
270 }
271 }
272 }
273 }
274
275 private void SendItemUpdateCreate(ClientView remoteClient, InventoryItem Item)
276 {
277
278 UpdateCreateInventoryItemPacket InventoryReply = new UpdateCreateInventoryItemPacket();
279 InventoryReply.AgentData.AgentID = remoteClient.AgentID;
280 InventoryReply.AgentData.SimApproved = true;
281 InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1];
282 InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock();
283 InventoryReply.InventoryData[0].ItemID = Item.ItemID;
284 InventoryReply.InventoryData[0].AssetID = Item.AssetID;
285 InventoryReply.InventoryData[0].CreatorID = Item.CreatorID;
286 InventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS;
287 InventoryReply.InventoryData[0].CreationDate = 1000;
288 InventoryReply.InventoryData[0].Description = _enc.GetBytes(Item.Description + "\0");
289 InventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS;
290 InventoryReply.InventoryData[0].Flags = 0;
291 InventoryReply.InventoryData[0].FolderID = Item.FolderID;
292 InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
293 InventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS;
294 InventoryReply.InventoryData[0].InvType = Item.InvType;
295 InventoryReply.InventoryData[0].Name = _enc.GetBytes(Item.Name + "\0");
296 InventoryReply.InventoryData[0].NextOwnerMask = FULL_MASK_PERMISSIONS;
297 InventoryReply.InventoryData[0].OwnerID = Item.OwnerID;
298 InventoryReply.InventoryData[0].OwnerMask = FULL_MASK_PERMISSIONS;
299 InventoryReply.InventoryData[0].SalePrice = 100;
300 InventoryReply.InventoryData[0].SaleType = 0;
301 InventoryReply.InventoryData[0].Type = Item.Type;
302 InventoryReply.InventoryData[0].CRC = Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS);
303
304 remoteClient.OutPacket(InventoryReply);
305 }
306 }
307
308
309
310 public class UserServerRequest
311 {
312 public UserServerRequest()
313 {
314
315 }
316 }
317}
diff --git a/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs b/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs
index a785eff..6a05ba2 100644
--- a/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs
+++ b/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs
@@ -29,7 +29,6 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using libsecondlife; 30using libsecondlife;
31using libsecondlife.Packets; 31using libsecondlife.Packets;
32using OpenSim.Assets;
33using OpenSim.Framework.Interfaces; 32using OpenSim.Framework.Interfaces;
34using OpenSim.Framework.Types; 33using OpenSim.Framework.Types;
35using OpenSim.Framework.Utilities; 34using OpenSim.Framework.Utilities;
@@ -45,13 +44,13 @@ namespace OpenSim.Region.ClientStack
45 private Dictionary<LLUUID, AssetTransaction> transactions = new Dictionary<LLUUID, AssetTransaction>(); 44 private Dictionary<LLUUID, AssetTransaction> transactions = new Dictionary<LLUUID, AssetTransaction>();
46 private ClientView ourClient; 45 private ClientView ourClient;
47 private AssetCache m_assetCache; 46 private AssetCache m_assetCache;
48 private InventoryCache m_inventoryCache; 47 // private InventoryCache m_inventoryCache;
49 48
50 public AgentAssetUpload(ClientView client, AssetCache assetCache, InventoryCache inventoryCache) 49 public AgentAssetUpload(ClientView client, AssetCache assetCache )
51 { 50 {
52 this.ourClient = client; 51 this.ourClient = client;
53 m_assetCache = assetCache; 52 m_assetCache = assetCache;
54 m_inventoryCache = inventoryCache; 53 // m_inventoryCache = inventoryCache;
55 } 54 }
56 55
57 public void AddUpload(LLUUID transactionID, AssetBase asset) 56 public void AddUpload(LLUUID transactionID, AssetBase asset)
@@ -187,7 +186,7 @@ namespace OpenSim.Region.ClientStack
187 if (trans.AddToInventory) 186 if (trans.AddToInventory)
188 { 187 {
189 // m_assetCache.AddAsset(trans.Asset); 188 // m_assetCache.AddAsset(trans.Asset);
190 m_inventoryCache.AddNewInventoryItem(this.ourClient, trans.InventFolder, trans.Asset); 189 //m_inventoryCache.AddNewInventoryItem(this.ourClient, trans.InventFolder, trans.Asset);
191 } 190 }
192 191
193 192
@@ -235,7 +234,7 @@ namespace OpenSim.Region.ClientStack
235 { 234 {
236 //already complete so we can add it to the inventory 235 //already complete so we can add it to the inventory
237 //m_assetCache.AddAsset(trans.Asset); 236 //m_assetCache.AddAsset(trans.Asset);
238 m_inventoryCache.AddNewInventoryItem(this.ourClient, packet.InventoryBlock.FolderID, trans.Asset); 237 // m_inventoryCache.AddNewInventoryItem(this.ourClient, packet.InventoryBlock.FolderID, trans.Asset);
239 } 238 }
240 else 239 else
241 { 240 {
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
index 89df290..9ceb4cd 100644
--- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
+++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
@@ -411,7 +411,7 @@ namespace OpenSim.Region.ClientStack
411 case PacketType.UpdateInventoryItem: 411 case PacketType.UpdateInventoryItem:
412 UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack; 412 UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack;
413 //Console.WriteLine(Pack.ToString()); 413 //Console.WriteLine(Pack.ToString());
414 for (int i = 0; i < update.InventoryData.Length; i++) 414 /*for (int i = 0; i < update.InventoryData.Length; i++)
415 { 415 {
416 if (update.InventoryData[i].TransactionID != LLUUID.Zero) 416 if (update.InventoryData[i].TransactionID != LLUUID.Zero)
417 { 417 {
@@ -439,7 +439,7 @@ namespace OpenSim.Region.ClientStack
439 { 439 {
440 m_inventoryCache.UpdateInventoryItemDetails(this, update.InventoryData[i].ItemID, update.InventoryData[i]); ; 440 m_inventoryCache.UpdateInventoryItemDetails(this, update.InventoryData[i].ItemID, update.InventoryData[i]); ;
441 } 441 }
442 } 442 }*/
443 break; 443 break;
444 case PacketType.RequestTaskInventory: 444 case PacketType.RequestTaskInventory:
445 RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack; 445 RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack;
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index 5a60096..a91c35d 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -33,7 +33,6 @@ using System.Threading;
33using System.Timers; 33using System.Timers;
34using libsecondlife; 34using libsecondlife;
35using libsecondlife.Packets; 35using libsecondlife.Packets;
36using OpenSim.Assets;
37using OpenSim.Framework; 36using OpenSim.Framework;
38using OpenSim.Framework.Console; 37using OpenSim.Framework.Console;
39using OpenSim.Framework.Interfaces; 38using OpenSim.Framework.Interfaces;
@@ -69,13 +68,13 @@ namespace OpenSim.Region.ClientStack
69 public Thread ClientThread; 68 public Thread ClientThread;
70 public LLVector3 startpos; 69 public LLVector3 startpos;
71 70
72 private AgentAssetUpload UploadAssets; 71 //private AgentAssetUpload UploadAssets;
73 private LLUUID newAssetFolder = LLUUID.Zero; 72 private LLUUID newAssetFolder = LLUUID.Zero;
74 private bool debug = false; 73 private bool debug = false;
75 protected IScene m_scene; 74 protected IScene m_scene;
76 private Dictionary<uint, ClientView> m_clientThreads; 75 private Dictionary<uint, ClientView> m_clientThreads;
77 private AssetCache m_assetCache; 76 private AssetCache m_assetCache;
78 private InventoryCache m_inventoryCache; 77 // private InventoryCache m_inventoryCache;
79 private int cachedtextureserial = 0; 78 private int cachedtextureserial = 0;
80 protected AgentCircuitManager m_authenticateSessionsHandler; 79 protected AgentCircuitManager m_authenticateSessionsHandler;
81 private Encoding enc = Encoding.ASCII; 80 private Encoding enc = Encoding.ASCII;
@@ -85,7 +84,7 @@ namespace OpenSim.Region.ClientStack
85 private int probesWithNoIngressPackets = 0; 84 private int probesWithNoIngressPackets = 0;
86 private int lastPacketsReceived = 0; 85 private int lastPacketsReceived = 0;
87 86
88 public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, IScene scene, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AgentCircuitManager authenSessions ) 87 public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, IScene scene, AssetCache assetCache, PacketServer packServer, AgentCircuitManager authenSessions )
89 { 88 {
90 m_moneyBalance = 1000; 89 m_moneyBalance = 1000;
91 90
@@ -94,7 +93,7 @@ namespace OpenSim.Region.ClientStack
94 m_assetCache = assetCache; 93 m_assetCache = assetCache;
95 94
96 m_networkServer = packServer; 95 m_networkServer = packServer;
97 m_inventoryCache = inventoryCache; 96 // m_inventoryCache = inventoryCache;
98 m_authenticateSessionsHandler = authenSessions; 97 m_authenticateSessionsHandler = authenSessions;
99 98
100 MainLog.Instance.Verbose( "OpenSimClient.cs - Started up new client thread to handle incoming request"); 99 MainLog.Instance.Verbose( "OpenSimClient.cs - Started up new client thread to handle incoming request");
@@ -105,7 +104,7 @@ namespace OpenSim.Region.ClientStack
105 104
106 PacketQueue = new BlockingQueue<QueItem>(); 105 PacketQueue = new BlockingQueue<QueItem>();
107 106
108 this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache); 107 //this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache);
109 AckTimer = new Timer(500); 108 AckTimer = new Timer(500);
110 AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); 109 AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed);
111 AckTimer.Start(); 110 AckTimer.Start();
diff --git a/OpenSim/Region/ClientStack/PacketServer.cs b/OpenSim/Region/ClientStack/PacketServer.cs
index 24bcfb1..66a7ffd 100644
--- a/OpenSim/Region/ClientStack/PacketServer.cs
+++ b/OpenSim/Region/ClientStack/PacketServer.cs
@@ -29,7 +29,6 @@ using System.Collections.Generic;
29using System.Net; 29using System.Net;
30using System.Net.Sockets; 30using System.Net.Sockets;
31using libsecondlife.Packets; 31using libsecondlife.Packets;
32using OpenSim.Assets;
33using OpenSim.Framework; 32using OpenSim.Framework;
34using OpenSim.Framework.Types; 33using OpenSim.Framework.Types;
35using OpenSim.Framework.Interfaces; 34using OpenSim.Framework.Interfaces;
@@ -122,9 +121,9 @@ namespace OpenSim.Region.ClientStack
122 121
123 } 122 }
124 123
125 protected virtual ClientView CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, IScene scene, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AgentCircuitManager authenSessions) 124 protected virtual ClientView CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, IScene scene, AssetCache assetCache, PacketServer packServer, AgentCircuitManager authenSessions)
126 { 125 {
127 return new ClientView(remoteEP, initialcirpack, clientThreads, scene, assetCache, packServer, inventoryCache, authenSessions ); 126 return new ClientView(remoteEP, initialcirpack, clientThreads, scene, assetCache, packServer, authenSessions );
128 } 127 }
129 128
130 /// <summary> 129 /// <summary>
@@ -136,10 +135,10 @@ namespace OpenSim.Region.ClientStack
136 /// <param name="inventoryCache"></param> 135 /// <param name="inventoryCache"></param>
137 /// <param name="authenticateSessionsClass"></param> 136 /// <param name="authenticateSessionsClass"></param>
138 /// <returns></returns> 137 /// <returns></returns>
139 public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache, InventoryCache inventoryCache, AgentCircuitManager authenticateSessionsClass) 138 public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache, AgentCircuitManager authenticateSessionsClass)
140 { 139 {
141 ClientView newuser = 140 ClientView newuser =
142 CreateNewClient(epSender, useCircuit, ClientThreads, _localScene, assetCache, this, inventoryCache, 141 CreateNewClient(epSender, useCircuit, ClientThreads, _localScene, assetCache, this,
143 authenticateSessionsClass); 142 authenticateSessionsClass);
144 143
145 this.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser); 144 this.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser);
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
index faf6f66..c84553a 100644
--- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs
+++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
@@ -28,7 +28,6 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Net; 30using System.Net;
31using OpenSim.Assets;
32using OpenSim.Framework; 31using OpenSim.Framework;
33using OpenSim.Framework.Console; 32using OpenSim.Framework.Console;
34using OpenSim.Framework.Data; 33using OpenSim.Framework.Data;
@@ -47,7 +46,6 @@ namespace OpenSim.Region.ClientStack
47 public abstract class RegionApplicationBase 46 public abstract class RegionApplicationBase
48 { 47 {
49 protected AssetCache m_assetCache; 48 protected AssetCache m_assetCache;
50 protected InventoryCache m_inventoryCache;
51 protected Dictionary<EndPoint, uint> m_clientCircuits = new Dictionary<EndPoint, uint>(); 49 protected Dictionary<EndPoint, uint> m_clientCircuits = new Dictionary<EndPoint, uint>();
52 protected DateTime m_startuptime; 50 protected DateTime m_startuptime;
53 protected NetworkServersInfo m_networkServersInfo; 51 protected NetworkServersInfo m_networkServersInfo;
@@ -58,9 +56,9 @@ namespace OpenSim.Region.ClientStack
58 protected LogBase m_log; 56 protected LogBase m_log;
59 protected CommunicationsManager m_commsManager; 57 protected CommunicationsManager m_commsManager;
60 58
61 public RegionApplicationBase( ) 59 public RegionApplicationBase()
62 { 60 {
63 m_startuptime = DateTime.Now; 61 m_startuptime = DateTime.Now;
64 } 62 }
65 63
66 virtual public void StartUp() 64 virtual public void StartUp()
@@ -69,16 +67,13 @@ namespace OpenSim.Region.ClientStack
69 ClientView.TerrainManager = new TerrainManager(new SecondLife()); 67 ClientView.TerrainManager = new TerrainManager(new SecondLife());
70 68
71 Initialize(); 69 Initialize();
72 70
73 ScenePresence.CreateDefaultTextureEntry(); 71 ScenePresence.CreateDefaultTextureEntry();
74 72
75 m_httpServer = new BaseHttpServer( m_httpServerPort ); 73 m_httpServer = new BaseHttpServer(m_httpServerPort);
76 74
77 m_log.Verbose("Starting HTTP server"); 75 m_log.Verbose("Starting HTTP server");
78 m_httpServer.Start(); 76 m_httpServer.Start();
79
80 m_inventoryCache = new InventoryCache();
81
82 } 77 }
83 78
84 protected abstract void Initialize(); 79 protected abstract void Initialize();
@@ -90,21 +85,21 @@ namespace OpenSim.Region.ClientStack
90 } 85 }
91 86
92 protected abstract LogBase CreateLog(); 87 protected abstract LogBase CreateLog();
93 protected abstract PhysicsScene GetPhysicsScene( ); 88 protected abstract PhysicsScene GetPhysicsScene();
94 protected abstract StorageManager CreateStorageManager(RegionInfo regionInfo); 89 protected abstract StorageManager CreateStorageManager(RegionInfo regionInfo);
95 90
96 protected PhysicsScene GetPhysicsScene(string engine) 91 protected PhysicsScene GetPhysicsScene(string engine)
97 { 92 {
98 PhysicsPluginManager physicsPluginManager; 93 PhysicsPluginManager physicsPluginManager;
99 physicsPluginManager = new PhysicsPluginManager(); 94 physicsPluginManager = new PhysicsPluginManager();
100 physicsPluginManager.LoadPlugins(); 95 physicsPluginManager.LoadPlugins();
101 return physicsPluginManager.GetPhysicsScene( engine ); 96 return physicsPluginManager.GetPhysicsScene(engine);
102 } 97 }
103 98
104 protected Scene SetupScene(RegionInfo regionInfo, out UDPServer udpServer) 99 protected Scene SetupScene(RegionInfo regionInfo, out UDPServer udpServer)
105 { 100 {
106 AgentCircuitManager authen = new AgentCircuitManager(); 101 AgentCircuitManager authen = new AgentCircuitManager();
107 udpServer = new UDPServer(regionInfo.InternalEndPoint.Port, m_assetCache, m_inventoryCache, m_log, authen); 102 udpServer = new UDPServer(regionInfo.InternalEndPoint.Port, m_assetCache, m_log, authen);
108 103
109 StorageManager storageManager = CreateStorageManager(regionInfo); 104 StorageManager storageManager = CreateStorageManager(regionInfo);
110 Scene scene = CreateScene(regionInfo, storageManager, authen); 105 Scene scene = CreateScene(regionInfo, storageManager, authen);
@@ -113,9 +108,9 @@ namespace OpenSim.Region.ClientStack
113 108
114 scene.LoadWorldMap(); 109 scene.LoadWorldMap();
115 110
116 scene.PhysScene = GetPhysicsScene( ); 111 scene.PhysScene = GetPhysicsScene();
117 scene.PhysScene.SetTerrain(scene.Terrain.GetHeights1D()); 112 scene.PhysScene.SetTerrain(scene.Terrain.GetHeights1D());
118 scene.LoadPrimsFromStorage(); 113 scene.LoadPrimsFromStorage();
119 114
120 //Master Avatar Setup 115 //Master Avatar Setup
121 UserProfileData masterAvatar = m_commsManager.UserServer.SetupMasterUser(scene.RegionInfo.MasterAvatarFirstName, scene.RegionInfo.MasterAvatarLastName, scene.RegionInfo.MasterAvatarSandboxPassword); 116 UserProfileData masterAvatar = m_commsManager.UserServer.SetupMasterUser(scene.RegionInfo.MasterAvatarFirstName, scene.RegionInfo.MasterAvatarLastName, scene.RegionInfo.MasterAvatarSandboxPassword);
diff --git a/OpenSim/Region/ClientStack/UDPServer.cs b/OpenSim/Region/ClientStack/UDPServer.cs
index 1e1801f..45eb0cd 100644
--- a/OpenSim/Region/ClientStack/UDPServer.cs
+++ b/OpenSim/Region/ClientStack/UDPServer.cs
@@ -30,7 +30,6 @@ using System.Collections.Generic;
30using System.Net; 30using System.Net;
31using System.Net.Sockets; 31using System.Net.Sockets;
32using libsecondlife.Packets; 32using libsecondlife.Packets;
33using OpenSim.Assets;
34using OpenSim.Framework; 33using OpenSim.Framework;
35using OpenSim.Framework.Types; 34using OpenSim.Framework.Types;
36using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
@@ -55,7 +54,6 @@ namespace OpenSim.Region.ClientStack
55 protected int listenPort; 54 protected int listenPort;
56 protected IScene m_localScene; 55 protected IScene m_localScene;
57 protected AssetCache m_assetCache; 56 protected AssetCache m_assetCache;
58 protected InventoryCache m_inventoryCache;
59 protected LogBase m_log; 57 protected LogBase m_log;
60 protected AgentCircuitManager m_authenticateSessionsClass; 58 protected AgentCircuitManager m_authenticateSessionsClass;
61 59
@@ -84,11 +82,10 @@ namespace OpenSim.Region.ClientStack
84 { 82 {
85 } 83 }
86 84
87 public UDPServer(int port, AssetCache assetCache, InventoryCache inventoryCache, LogBase console, AgentCircuitManager authenticateClass) 85 public UDPServer(int port, AssetCache assetCache, LogBase console, AgentCircuitManager authenticateClass)
88 { 86 {
89 listenPort = port; 87 listenPort = port;
90 this.m_assetCache = assetCache; 88 this.m_assetCache = assetCache;
91 this.m_inventoryCache = inventoryCache;
92 this.m_log = console; 89 this.m_log = console;
93 this.m_authenticateSessionsClass = authenticateClass; 90 this.m_authenticateSessionsClass = authenticateClass;
94 this.CreatePacketServer(); 91 this.CreatePacketServer();
@@ -133,7 +130,7 @@ namespace OpenSim.Region.ClientStack
133 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet; 130 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet;
134 this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); 131 this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
135 132
136 this.PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_inventoryCache, m_authenticateSessionsClass); 133 this.PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_authenticateSessionsClass);
137 } 134 }
138 135
139 public void ServerListener() 136 public void ServerListener()
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs
index 64fe975..daa4203 100644
--- a/OpenSim/Region/Examples/SimpleApp/Program.cs
+++ b/OpenSim/Region/Examples/SimpleApp/Program.cs
@@ -1,7 +1,6 @@
1using System; 1using System;
2using System.Net; 2using System.Net;
3using libsecondlife; 3using libsecondlife;
4using OpenSim.Assets;
5using OpenSim.Framework; 4using OpenSim.Framework;
6using OpenSim.Framework.Console; 5using OpenSim.Framework.Console;
7using OpenSim.Framework.Interfaces; 6using OpenSim.Framework.Interfaces;