aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Capabilities/Caps.cs
diff options
context:
space:
mode:
authorlbsa712007-11-06 11:10:45 +0000
committerlbsa712007-11-06 11:10:45 +0000
commitee1fcc729c9fe4df367a12ffe4a0d90c7378c160 (patch)
treecc1ecc6f5fe304184ec7c371f950745c948e28a4 /OpenSim/Framework/Communications/Capabilities/Caps.cs
parentteravus debug patch of libode.so from libs (diff)
downloadopensim-SC-ee1fcc729c9fe4df367a12ffe4a0d90c7378c160.zip
opensim-SC-ee1fcc729c9fe4df367a12ffe4a0d90c7378c160.tar.gz
opensim-SC-ee1fcc729c9fe4df367a12ffe4a0d90c7378c160.tar.bz2
opensim-SC-ee1fcc729c9fe4df367a12ffe4a0d90c7378c160.tar.xz
* Added better logging to AssetCache
* AssetCache now ignores duplicate uploads * some m_ refactoring * ignored some bins
Diffstat (limited to 'OpenSim/Framework/Communications/Capabilities/Caps.cs')
-rw-r--r--OpenSim/Framework/Communications/Capabilities/Caps.cs67
1 files changed, 34 insertions, 33 deletions
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs
index 23dfcc6..51a4598 100644
--- a/OpenSim/Framework/Communications/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs
@@ -58,24 +58,25 @@ namespace OpenSim.Region.Capabilities
58 //private string m_requestTexture = "0003/"; 58 //private string m_requestTexture = "0003/";
59 private string m_notecardUpdatePath = "0004/"; 59 private string m_notecardUpdatePath = "0004/";
60 //private string eventQueue = "0100/"; 60 //private string eventQueue = "0100/";
61 private BaseHttpServer httpListener; 61 private BaseHttpServer m_httpListener;
62 private LLUUID agentID; 62 private LLUUID m_agentID;
63 private AssetCache assetCache; 63 private AssetCache m_assetCache;
64 private int eventQueueCount = 1; 64 private int m_eventQueueCount = 1;
65 private Queue<string> CapsEventQueue = new Queue<string>(); 65 private Queue<string> m_capsEventQueue = new Queue<string>();
66 public NewInventoryItem AddNewInventoryItem = null;
67 public ItemUpdatedCallback ItemUpdatedCall = null;
68 private bool m_dumpAssetsToFile; 66 private bool m_dumpAssetsToFile;
69 67
70 public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath, 68 public NewInventoryItem AddNewInventoryItem = null;
69 public ItemUpdatedCallback ItemUpdatedCall = null;
70
71 public Caps(AssetCache assetCache, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath,
71 LLUUID agent, bool dumpAssetsToFile) 72 LLUUID agent, bool dumpAssetsToFile)
72 { 73 {
73 assetCache = assetCach; 74 m_assetCache = assetCache;
74 m_capsObjectPath = capsPath; 75 m_capsObjectPath = capsPath;
75 httpListener = httpServer; 76 m_httpListener = httpServer;
76 m_httpListenerHostName = httpListen; 77 m_httpListenerHostName = httpListen;
77 m_httpListenPort = httpPort; 78 m_httpListenPort = httpPort;
78 agentID = agent; 79 m_agentID = agent;
79 m_dumpAssetsToFile = dumpAssetsToFile; 80 m_dumpAssetsToFile = dumpAssetsToFile;
80 } 81 }
81 82
@@ -88,17 +89,17 @@ namespace OpenSim.Region.Capabilities
88 string capsBase = "/CAPS/" + m_capsObjectPath; 89 string capsBase = "/CAPS/" + m_capsObjectPath;
89 try 90 try
90 { 91 {
91 httpListener.AddStreamHandler( 92 m_httpListener.AddStreamHandler(
92 new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath, 93 new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath,
93 GetMapLayer)); 94 GetMapLayer));
94 httpListener.AddStreamHandler( 95 m_httpListener.AddStreamHandler(
95 new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", 96 new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST",
96 capsBase + m_newInventory, 97 capsBase + m_newInventory,
97 NewAgentInventoryRequest)); 98 NewAgentInventoryRequest));
98 99
99 AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest); 100 AddLegacyCapsHandler(m_httpListener, m_requestPath, CapsRequest);
100 //AddLegacyCapsHandler(httpListener, m_requestTexture , RequestTexture); 101 //AddLegacyCapsHandler(m_httpListener, m_requestTexture , RequestTexture);
101 AddLegacyCapsHandler(httpListener, m_notecardUpdatePath, NoteCardAgentInventory); 102 AddLegacyCapsHandler(m_httpListener, m_notecardUpdatePath, NoteCardAgentInventory);
102 } 103 }
103 catch 104 catch
104 { 105 {
@@ -198,11 +199,11 @@ namespace OpenSim.Region.Capabilities
198 { 199 {
199 string res = ""; 200 string res = "";
200 201
201 if (CapsEventQueue.Count > 0) 202 if (m_capsEventQueue.Count > 0)
202 { 203 {
203 lock (CapsEventQueue) 204 lock (m_capsEventQueue)
204 { 205 {
205 string item = CapsEventQueue.Dequeue(); 206 string item = m_capsEventQueue.Dequeue();
206 res = item; 207 res = item;
207 } 208 }
208 } 209 }
@@ -222,13 +223,13 @@ namespace OpenSim.Region.Capabilities
222 public string CreateEstablishAgentComms(string caps, string ipAddressPort) 223 public string CreateEstablishAgentComms(string caps, string ipAddressPort)
223 { 224 {
224 LLSDCapEvent eventItem = new LLSDCapEvent(); 225 LLSDCapEvent eventItem = new LLSDCapEvent();
225 eventItem.id = eventQueueCount; 226 eventItem.id = m_eventQueueCount;
226 //should be creating a EstablishAgentComms item, but there isn't a class for it yet 227 //should be creating a EstablishAgentComms item, but there isn't a class for it yet
227 eventItem.events.Array.Add(new LLSDEmpty()); 228 eventItem.events.Array.Add(new LLSDEmpty());
228 string res = LLSDHelpers.SerialiseLLSDReply(eventItem); 229 string res = LLSDHelpers.SerialiseLLSDReply(eventItem);
229 eventQueueCount++; 230 m_eventQueueCount++;
230 231
231 CapsEventQueue.Enqueue(res); 232 m_capsEventQueue.Enqueue(res);
232 return res; 233 return res;
233 } 234 }
234 235
@@ -239,10 +240,10 @@ namespace OpenSim.Region.Capabilities
239 public string CreateEmptyEventResponse() 240 public string CreateEmptyEventResponse()
240 { 241 {
241 LLSDCapEvent eventItem = new LLSDCapEvent(); 242 LLSDCapEvent eventItem = new LLSDCapEvent();
242 eventItem.id = eventQueueCount; 243 eventItem.id = m_eventQueueCount;
243 eventItem.events.Array.Add(new LLSDEmpty()); 244 eventItem.events.Array.Add(new LLSDEmpty());
244 string res = LLSDHelpers.SerialiseLLSDReply(eventItem); 245 string res = LLSDHelpers.SerialiseLLSDReply(eventItem);
245 eventQueueCount++; 246 m_eventQueueCount++;
246 return res; 247 return res;
247 } 248 }
248 249
@@ -266,10 +267,10 @@ namespace OpenSim.Region.Capabilities
266 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); 267 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
267 268
268 ItemUpdater uploader = 269 ItemUpdater uploader =
269 new ItemUpdater(newInvItem, capsBase + uploaderPath, httpListener, m_dumpAssetsToFile); 270 new ItemUpdater(newInvItem, capsBase + uploaderPath, m_httpListener, m_dumpAssetsToFile);
270 uploader.OnUpLoad += ItemUpdated; 271 uploader.OnUpLoad += ItemUpdated;
271 272
272 httpListener.AddStreamHandler( 273 m_httpListener.AddStreamHandler(
273 new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); 274 new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
274 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + 275 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase +
275 uploaderPath; 276 uploaderPath;
@@ -300,8 +301,8 @@ namespace OpenSim.Region.Capabilities
300 301
301 AssetUploader uploader = 302 AssetUploader uploader =
302 new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, 303 new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type,
303 llsdRequest.asset_type, capsBase + uploaderPath, httpListener, m_dumpAssetsToFile); 304 llsdRequest.asset_type, capsBase + uploaderPath, m_httpListener, m_dumpAssetsToFile);
304 httpListener.AddStreamHandler( 305 m_httpListener.AddStreamHandler(
305 new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); 306 new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
306 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + 307 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase +
307 uploaderPath; 308 uploaderPath;
@@ -344,11 +345,11 @@ namespace OpenSim.Region.Capabilities
344 asset.InvType = inType; 345 asset.InvType = inType;
345 asset.Name = assetName; 346 asset.Name = assetName;
346 asset.Data = data; 347 asset.Data = data;
347 assetCache.AddAsset(asset); 348 m_assetCache.AddAsset(asset);
348 349
349 InventoryItemBase item = new InventoryItemBase(); 350 InventoryItemBase item = new InventoryItemBase();
350 item.avatarID = agentID; 351 item.avatarID = m_agentID;
351 item.creatorsID = agentID; 352 item.creatorsID = m_agentID;
352 item.inventoryID = inventoryItem; 353 item.inventoryID = inventoryItem;
353 item.assetID = asset.FullID; 354 item.assetID = asset.FullID;
354 item.inventoryDescription = assetDescription; 355 item.inventoryDescription = assetDescription;
@@ -361,7 +362,7 @@ namespace OpenSim.Region.Capabilities
361 362
362 if (AddNewInventoryItem != null) 363 if (AddNewInventoryItem != null)
363 { 364 {
364 AddNewInventoryItem(agentID, item); 365 AddNewInventoryItem(m_agentID, item);
365 } 366 }
366 } 367 }
367 368
@@ -369,7 +370,7 @@ namespace OpenSim.Region.Capabilities
369 { 370 {
370 if (ItemUpdatedCall != null) 371 if (ItemUpdatedCall != null)
371 { 372 {
372 return ItemUpdatedCall(agentID, itemID, data); 373 return ItemUpdatedCall(m_agentID, itemID, data);
373 } 374 }
374 return LLUUID.Zero; 375 return LLUUID.Zero;
375 } 376 }