Added some place holder classes for various modules.

Some work on the asset cache, can people please test this. including on one of the public systems so we can see if it causes problems with multiple users.
afrisby
MW 2007-08-30 13:47:04 +00:00
parent 5735d611de
commit e1505be97f
10 changed files with 218 additions and 40 deletions

View File

@ -212,41 +212,41 @@ namespace OpenSim.Framework.Communications.Caches
while (true)
{
TextureSender sender = this.QueueTextures.Dequeue();
if (TimesTextureSent.ContainsKey(sender.request.RequestUser.AgentId))
{
if (TimesTextureSent[sender.request.RequestUser.AgentId].ContainsKey(sender.request.ImageInfo.FullID))
{
TimesTextureSent[sender.request.RequestUser.AgentId][sender.request.ImageInfo.FullID]++;
}
else
{
TimesTextureSent[sender.request.RequestUser.AgentId].Add(sender.request.ImageInfo.FullID, 1);
}
}
else
{
Dictionary<LLUUID, int> UsersSent = new Dictionary<LLUUID,int>();
TimesTextureSent.Add(sender.request.RequestUser.AgentId, UsersSent );
UsersSent.Add(sender.request.ImageInfo.FullID, 1);
/* if (TimesTextureSent.ContainsKey(sender.request.RequestUser.AgentId))
{
if (TimesTextureSent[sender.request.RequestUser.AgentId].ContainsKey(sender.request.ImageInfo.FullID))
{
TimesTextureSent[sender.request.RequestUser.AgentId][sender.request.ImageInfo.FullID]++;
}
else
{
TimesTextureSent[sender.request.RequestUser.AgentId].Add(sender.request.ImageInfo.FullID, 1);
}
}
else
{
Dictionary<LLUUID, int> UsersSent = new Dictionary<LLUUID,int>();
TimesTextureSent.Add(sender.request.RequestUser.AgentId, UsersSent );
UsersSent.Add(sender.request.ImageInfo.FullID, 1);
}
if (TimesTextureSent[sender.request.RequestUser.AgentId][sender.request.ImageInfo.FullID] < 1000)
{
bool finished = sender.SendTexture();
if (finished)
{
this.TextureSent(sender);
}
else
{
// Console.WriteLine("readding texture");
this.QueueTextures.Enqueue(sender);
}
}
else
}
if (TimesTextureSent[sender.request.RequestUser.AgentId][sender.request.ImageInfo.FullID] < 1000)
{*/
bool finished = sender.SendTexture();
if (finished)
{
this.TextureSent(sender);
}
else
{
// Console.WriteLine("readding texture");
this.QueueTextures.Enqueue(sender);
}
/* }
else
{
this.TextureSent(sender);
}*/
}
}
@ -336,7 +336,7 @@ namespace OpenSim.Framework.Communications.Caches
ImageNotInDatabasePacket notFound = new ImageNotInDatabasePacket();
notFound.ImageID.ID = assetID;
req.RequestUser.OutPacket(notFound);
//Console.WriteLine("sending image not found for " + assetID);
//Console.WriteLine("sending image not found for " + assetID);
this.RequestedTextures.Remove(assetID);
}
@ -532,9 +532,9 @@ namespace OpenSim.Framework.Communications.Caches
/// </summary>
/// <param name="userInfo"></param>
/// <param name="imageID"></param>
public void AddTextureRequest(IClientAPI userInfo, LLUUID imageID, uint packetNumber)
public void AddTextureRequest(IClientAPI userInfo, LLUUID imageID, uint packetNumber, int discard)
{
//Console.WriteLine("texture request for " + imageID.ToStringHyphenated() + " packetnumber= " + packetNumber);
//Console.WriteLine("texture request for " + imageID.ToStringHyphenated() + " packetnumber= " + packetNumber);
//check to see if texture is in local cache, if not request from asset server
if (!this.AvatarRecievedTextures.ContainsKey(userInfo.AgentId))
{
@ -554,6 +554,7 @@ namespace OpenSim.Framework.Communications.Caches
request.RequestUser = userInfo;
request.RequestAssetID = imageID;
request.IsTextureRequest = true;
request.DiscardLevel = discard;
this.RequestedTextures.Add(imageID, request);
this._assetServer.RequestAsset(imageID, true);
}
@ -567,6 +568,7 @@ namespace OpenSim.Framework.Communications.Caches
req.RequestAssetID = imageID;
req.IsTextureRequest = true;
req.ImageInfo = imag;
req.DiscardLevel = discard;
if (imag.Data.LongLength > 600)
{
@ -641,6 +643,7 @@ namespace OpenSim.Framework.Communications.Caches
public byte[] Params = null;
//public bool AssetInCache;
//public int TimeRequested;
public int DiscardLevel = -1;
public AssetRequest()
{
@ -700,7 +703,7 @@ namespace OpenSim.Framework.Communications.Caches
SendPacket();
counter++;
if ((request.PacketCounter >= request.NumPackets) | counter > 100 | (request.NumPackets == 1))
if ((request.PacketCounter >= request.NumPackets) | counter > 100 | (request.NumPackets == 1) | (request.DiscardLevel == -1))
{
return true;
}
@ -746,7 +749,7 @@ namespace OpenSim.Framework.Communications.Caches
req.PacketCounter++;
//req.ImageInfo.last_used = time;
//System.Console.WriteLine("sent first packet of texture: " + req.ImageInfo.FullID);
//Console.WriteLine("sending packet 1 for " + req.ImageInfo.FullID.ToStringHyphenated());
//Console.WriteLine("sending packet 1 for " + req.ImageInfo.FullID.ToStringHyphenated());
}
}
else
@ -758,11 +761,11 @@ namespace OpenSim.Framework.Communications.Caches
im.Header.Reliable = false;
im.ImageID.Packet = (ushort)(req.PacketCounter);
im.ImageID.ID = req.ImageInfo.FullID;
int size = req.ImageInfo.Data.Length - 600 - (1000 * (req.PacketCounter-1));
int size = req.ImageInfo.Data.Length - 600 - (1000 * (req.PacketCounter - 1));
if (size > 1000) size = 1000;
//Console.WriteLine("length= {0} counter= {1} size= {2}",req.ImageInfo.Data.Length, req.PacketCounter, size);
im.ImageData.Data = new byte[size];
Array.Copy(req.ImageInfo.Data, 600 + (1000 * (req.PacketCounter-1)), im.ImageData.Data, 0, size);
Array.Copy(req.ImageInfo.Data, 600 + (1000 * (req.PacketCounter - 1)), im.ImageData.Data, 0, size);
req.RequestUser.OutPacket(im);
req.PacketCounter++;
//req.ImageInfo.last_used = time;

View File

@ -127,6 +127,7 @@ namespace OpenSim.Region.Capabilities
LLSDCapsDetails caps = new LLSDCapsDetails();
string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + m_capsObjectPath;
caps.MapLayer = capsBaseUrl + m_mapLayerPath;
// caps.RequestTextureDownload = capsBaseUrl + m_requestTexture;
caps.NewFileAgentInventory = capsBaseUrl + m_newInventory;
caps.UpdateNotecardAgentInventory = capsBaseUrl + m_notecardUpdatePath;
caps.UpdateScriptAgentInventory = capsBaseUrl + m_notecardUpdatePath;

View File

@ -102,6 +102,7 @@ namespace OpenSim
}
ReadConfigSettings(startupSource);
}
protected void ReadConfigSettings(IConfigSource configSource)
@ -124,6 +125,7 @@ namespace OpenSim
m_networkServersInfo.loadFromConfiguration(configSource);
}
/// <summary>
/// Performs initialisation of the scene, such as loading configuration from disk.
/// </summary>

View File

@ -197,7 +197,7 @@ namespace OpenSim.Region.ClientStack
{
if (AgentAni.AnimationList[i].StartAnim)
{
if (OnStartAnim != null)
{
OnStartAnim(this, AgentAni.AnimationList[i].AnimID, 1);
@ -355,7 +355,9 @@ namespace OpenSim.Region.ClientStack
//Console.WriteLine("image request: " + Pack.ToString());
for (int i = 0; i < imageRequest.RequestImage.Length; i++)
{
m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image, imageRequest.RequestImage[i].Packet);
// Console.WriteLine("image request of "+ imageRequest.RequestImage[i].Image+ " at discard level " + imageRequest.RequestImage[i].DiscardLevel);
m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image, imageRequest.RequestImage[i].Packet, imageRequest.RequestImage[i].DiscardLevel);
}
break;
case PacketType.TransferRequest:

View File

@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.Framework.Interfaces;
namespace OpenSim.Region.Environment.Interfaces
{
public interface ITerrain
{
bool Tainted();
bool Tainted(int x, int y);
void ResetTaint();
void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, IClientAPI remoteUser);
void CheckHeightValues();
float[] GetHeights1D();
float[,] GetHeights2D();
double[,] GetHeights2DD();
void GetHeights1D(float[] heights);
void SetHeights2D(float[,] heights);
void SetHeights2D(double[,] heights);
void SwapRevertMaps();
void SaveRevertMap();
bool RunTerrainCmd(string[] args, ref string resultText, string simName);
void SetRange(float min, float max);
void LoadFromFileF64(string filename);
void LoadFromFileF32(string filename);
void LoadFromFileF32(string filename, int dimensionX, int dimensionY, int lowerboundX, int lowerboundY);
void LoadFromFileIMG(string filename, int dimensionX, int dimensionY, int lowerboundX, int lowerboundY);
void LoadFromFileSLRAW(string filename);
void WriteToFileF64(string filename);
void WriteToFileF32(string filename);
void WriteToFileRAW(string filename);
void WriteToFileHiRAW(string filename);
void SetSeed(int val);
void RaiseTerrain(double rx, double ry, double size, double amount);
void LowerTerrain(double rx, double ry, double size, double amount);
void FlattenTerrain(double rx, double ry, double size, double amount);
void NoiseTerrain(double rx, double ry, double size, double amount);
void RevertTerrain(double rx, double ry, double size, double amount);
void SmoothTerrain(double rx, double ry, double size, double amount);
void HillsGenerator();
double GetHeight(int x, int y);
void ExportImage(string filename, string gradientmap);
byte[] ExportJpegImage(string gradientmap);
}
}

View File

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces;
namespace OpenSim.Region.Environment.Modules
{
public class AssetDownloadModule : IRegionModule
{
private Scene m_scene;
public AssetDownloadModule()
{
}
public void Initialise(Scene scene)
{
m_scene = scene;
m_scene.EventManager.OnNewClient += NewClient;
}
public void PostInitialise()
{
}
public void CloseDown()
{
}
public string GetName()
{
return "AssetDownloadModule";
}
public void NewClient(IClientAPI client)
{
}
}
}

View File

@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Region.Environment.Modules
{
public class FriendsModule
{
}
}

View File

@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Region.Environment.Modules
{
public class InstantMessageModule
{
}
}

View File

@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Region.Environment.Modules
{
public class InventoryModule
{
}
}

View File

@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces;
namespace OpenSim.Region.Environment.Modules
{
public class TextureDownloadModule :IRegionModule
{
private Scene m_scene;
public TextureDownloadModule()
{
}
public void Initialise(Scene scene)
{
m_scene = scene;
m_scene.EventManager.OnNewClient += NewClient;
}
public void PostInitialise()
{
}
public void CloseDown()
{
}
public string GetName()
{
return "TextureDownloadModule";
}
public void NewClient(IClientAPI client)
{
}
public void TextureAssetCallback(LLUUID texture, byte[] data)
{
}
}
}