From 1b8b75d80ae5d61fcbac60602cf9af6cef2c4003 Mon Sep 17 00:00:00 2001
From: MW
Date: Sun, 24 Jun 2007 16:19:53 +0000
Subject: A bit more work on the AssetCache.
---
OpenSim/OpenSim.Caches/AssetCache.cs | 12 +++++++++---
OpenSim/OpenSim.Region/Caps.cs | 14 +++++++-------
OpenSim/OpenSim.Region/Scenes/Scene.cs | 5 -----
.../OpenSim.RegionServer/ClientView.AgentAssetUpload.cs | 1 +
4 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/OpenSim/OpenSim.Caches/AssetCache.cs b/OpenSim/OpenSim.Caches/AssetCache.cs
index 44d22a9..f310752 100644
--- a/OpenSim/OpenSim.Caches/AssetCache.cs
+++ b/OpenSim/OpenSim.Caches/AssetCache.cs
@@ -571,17 +571,23 @@ namespace OpenSim.Caches
{
public AssetRequest request;
public event DownloadComplete OnComplete;
-
+ Thread m_thread;
public TextureSender(AssetRequest req)
{
request = req;
//Console.WriteLine("creating worker thread for texture " + req.ImageInfo.FullID.ToStringHyphenated());
//Console.WriteLine("texture data length is " + req.ImageInfo.Data.Length);
// Console.WriteLine("in " + req.NumPackets + " packets");
- ThreadPool.QueueUserWorkItem(new WaitCallback(SendTexture), new object());
+ //ThreadPool.QueueUserWorkItem(new WaitCallback(SendTexture), new object());
+
+ //need some sort of custom threadpool here, as using the .net one, overloads it and stops the handling of incoming packets etc
+ //but don't really want to create a thread for every texture download
+ m_thread = new Thread(new ThreadStart(SendTexture));
+ m_thread.IsBackground = true;
+ m_thread.Start();
}
- public void SendTexture(Object obj)
+ public void SendTexture()
{
//Console.WriteLine("starting to send sending texture " + request.ImageInfo.FullID.ToStringHyphenated());
while (request.PacketCounter != request.NumPackets)
diff --git a/OpenSim/OpenSim.Region/Caps.cs b/OpenSim/OpenSim.Region/Caps.cs
index 5be481e..59f24e3 100644
--- a/OpenSim/OpenSim.Region/Caps.cs
+++ b/OpenSim/OpenSim.Region/Caps.cs
@@ -86,7 +86,6 @@ namespace OpenSim.Region
///
public string MapLayer(string request, string path, string param)
{
-
string res = "";
@@ -119,12 +118,12 @@ namespace OpenSim.Region
public string NewAgentInventory(string request, string path, string param)
{
-
//Console.WriteLine("received upload request:"+ request);
string res = "";
LLUUID newAsset = LLUUID.Random();
- string uploaderPath = capsObjectPath + Util.RandomClass.Next(5000, 7000).ToString("0000");
- AssetUploader uploader = new AssetUploader(newAsset, uploaderPath, this.httpListener);
+ LLUUID newInvItem = LLUUID.Random();
+ string uploaderPath = capsObjectPath + Util.RandomClass.Next(5000, 8000).ToString("0000");
+ AssetUploader uploader = new AssetUploader(newAsset,newInvItem, uploaderPath, this.httpListener);
httpListener.AddRestHandler("POST", "/CAPS/" + uploaderPath, uploader.uploaderCaps);
string uploaderURL = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + uploaderPath;
Console.WriteLine("uploader url is " + uploaderURL);
@@ -157,11 +156,12 @@ namespace OpenSim.Region
private string uploaderPath = "";
private LLUUID newAssetID;
- //private LLUUID inventoryItemID;
+ private LLUUID inventoryItemID;
private BaseHttpServer httpListener;
- public AssetUploader(LLUUID assetID, string path,BaseHttpServer httpServer)
+ public AssetUploader(LLUUID assetID, LLUUID inventoryItem, string path, BaseHttpServer httpServer)
{
newAssetID = assetID;
+ inventoryItemID = inventoryItem;
uploaderPath = path;
httpListener = httpServer;
@@ -172,7 +172,7 @@ namespace OpenSim.Region
Encoding _enc = System.Text.Encoding.UTF8;
byte[] data = _enc.GetBytes(request);
//Console.WriteLine("recieved upload " + Util.FieldToString(data));
- LLUUID inv = LLUUID.Random();
+ LLUUID inv = this.inventoryItemID;
string res = "";
res += "";
res += "new_asset" + newAssetID.ToStringHyphenated() + "";
diff --git a/OpenSim/OpenSim.Region/Scenes/Scene.cs b/OpenSim/OpenSim.Region/Scenes/Scene.cs
index 07b1ee4..ad6d336 100644
--- a/OpenSim/OpenSim.Region/Scenes/Scene.cs
+++ b/OpenSim/OpenSim.Region/Scenes/Scene.cs
@@ -422,10 +422,6 @@ namespace OpenSim.Region.Scenes
float[] map = this.localStorage.LoadWorld();
if (map == null)
{
- // Console.WriteLine("creating new terrain");
- // this.Terrain.hills();
-
- // this.localStorage.SaveMap(this.Terrain.getHeights1D());
if (string.IsNullOrEmpty(this.m_regInfo.estateSettings.terrainFile))
{
Console.WriteLine("No default terrain, procedurally generating...");
@@ -795,7 +791,6 @@ namespace OpenSim.Region.Scenes
{
List mapBlocks;
mapBlocks = this.commsManager.GridServer.RequestNeighbourMapBlocks(minX, minY, maxX, maxY);
- Console.WriteLine("number of mapblocks " + mapBlocks.Count +" in "+ minX +" , " + minY + " , "+ maxX + " , "+ maxY);
remoteClient.SendMapBlock(mapBlocks);
}
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.AgentAssetUpload.cs b/OpenSim/OpenSim.RegionServer/ClientView.AgentAssetUpload.cs
index 1b01f24..914c38a 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.AgentAssetUpload.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.AgentAssetUpload.cs
@@ -289,6 +289,7 @@ namespace OpenSim
if (Asset.Data.Length > 2)
{
+ //data block should only have data in it, if there is no more data to be uploaded
this.SendCompleteMessage();
}
else
--
cgit v1.1