A bit more work on the AssetCache.

Sugilite
MW 2007-06-24 16:19:53 +00:00
parent 38a800400a
commit 1b8b75d80a
4 changed files with 17 additions and 15 deletions

View File

@ -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)

View File

@ -86,7 +86,6 @@ namespace OpenSim.Region
/// <returns></returns>
public string MapLayer(string request, string path, string param)
{
string res = "<llsd><map><key>AgentData</key><map><key>Flags</key><integer>0</integer></map><key>LayerData</key><array>";
res += this.BuildLLSDMapLayerResponse();
res += "</array></map></llsd>";
@ -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 += "<llsd><map>";
res += "<key>new_asset</key><string>" + newAssetID.ToStringHyphenated() + "</string>";

View File

@ -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<MapBlockData> 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);
}

View File

@ -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