* added two new commands (for debug/disaster recovery)
'show assets' shows the current state of the asset cache (number of cached assets, requests, et c) 'clear-assets' forcibly re-initializes the asset cache thereby freeing all cached items. 'clear-assets' is not to be used lightly, as it probably introduces mem inconsistencies and doubling up of textures.ThreadPoolClientBranch
parent
4d376ee630
commit
176a1fe382
|
@ -49,31 +49,61 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
public Dictionary<LLUUID, AssetInfo> Assets;
|
public Dictionary<LLUUID, AssetInfo> Assets;
|
||||||
public Dictionary<LLUUID, TextureImage> Textures;
|
public Dictionary<LLUUID, TextureImage> Textures;
|
||||||
|
|
||||||
public List<AssetRequest> AssetRequests = new List<AssetRequest>(); //assets ready to be sent to viewers
|
public List<AssetRequest> AssetRequests; //assets ready to be sent to viewers
|
||||||
public List<AssetRequest> TextureRequests = new List<AssetRequest>(); //textures ready to be sent
|
public List<AssetRequest> TextureRequests; //textures ready to be sent
|
||||||
|
|
||||||
public Dictionary<LLUUID, AssetRequest> RequestedAssets = new Dictionary<LLUUID, AssetRequest>();
|
public Dictionary<LLUUID, AssetRequest> RequestedAssets;
|
||||||
//Assets requested from the asset server
|
//Assets requested from the asset server
|
||||||
|
|
||||||
public Dictionary<LLUUID, AssetRequest> RequestedTextures = new Dictionary<LLUUID, AssetRequest>();
|
public Dictionary<LLUUID, AssetRequest> RequestedTextures;
|
||||||
//Textures requested from the asset server
|
//Textures requested from the asset server
|
||||||
|
|
||||||
public Dictionary<LLUUID, AssetRequestsList> RequestLists = new Dictionary<LLUUID, AssetRequestsList>();
|
public Dictionary<LLUUID, AssetRequestsList> RequestLists;
|
||||||
|
|
||||||
private readonly IAssetServer m_assetServer;
|
private readonly IAssetServer m_assetServer;
|
||||||
|
|
||||||
private readonly Thread m_assetCacheThread;
|
private readonly Thread m_assetCacheThread;
|
||||||
|
|
||||||
/// <summary>
|
public void ShowState()
|
||||||
///
|
{
|
||||||
/// </summary>
|
m_log.InfoFormat("Assets:{0} Testures:{1} AssetRequests:{2} TextureRequests:{3} RequestedAssets:{4} RequestedTextures:{5} RequestLists:{6}",
|
||||||
|
Assets.Count,
|
||||||
|
Textures.Count,
|
||||||
|
AssetRequests.Count,
|
||||||
|
TextureRequests.Count,
|
||||||
|
RequestedAssets.Count,
|
||||||
|
RequestedTextures.Count,
|
||||||
|
RequestLists.Count );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Clear()
|
||||||
|
{
|
||||||
|
m_log.Info("[ASSETSTORAGE]: Clearing Asset cache");
|
||||||
|
Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Initialize()
|
||||||
|
{
|
||||||
|
Assets = new Dictionary<LLUUID, AssetInfo>();
|
||||||
|
Textures = new Dictionary<LLUUID, TextureImage>();
|
||||||
|
AssetRequests = new List<AssetRequest>(); //assets ready to be sent to viewers
|
||||||
|
TextureRequests = new List<AssetRequest>(); //textures ready to be sent
|
||||||
|
|
||||||
|
RequestedAssets = new Dictionary<LLUUID, AssetRequest>();
|
||||||
|
RequestedTextures = new Dictionary<LLUUID, AssetRequest>();
|
||||||
|
RequestLists = new Dictionary<LLUUID, AssetRequestsList>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public AssetCache(IAssetServer assetServer)
|
public AssetCache(IAssetServer assetServer)
|
||||||
{
|
{
|
||||||
m_log.Info("[ASSETSTORAGE]: Creating Asset cache");
|
m_log.Info("[ASSETSTORAGE]: Creating Asset cache");
|
||||||
|
Initialize();
|
||||||
|
|
||||||
m_assetServer = assetServer;
|
m_assetServer = assetServer;
|
||||||
m_assetServer.SetReceiver(this);
|
m_assetServer.SetReceiver(this);
|
||||||
Assets = new Dictionary<LLUUID, AssetInfo>();
|
|
||||||
Textures = new Dictionary<LLUUID, TextureImage>();
|
|
||||||
m_assetCacheThread = new Thread(new ThreadStart(RunAssetManager));
|
m_assetCacheThread = new Thread(new ThreadStart(RunAssetManager));
|
||||||
m_assetCacheThread.IsBackground = true;
|
m_assetCacheThread.IsBackground = true;
|
||||||
m_assetCacheThread.Start();
|
m_assetCacheThread.Start();
|
||||||
|
@ -384,7 +414,7 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
{
|
{
|
||||||
// over max number of bytes so split up file
|
// over max number of bytes so split up file
|
||||||
long restData = data.LongLength - m_maxPacketSize;
|
long restData = data.LongLength - m_maxPacketSize;
|
||||||
int restPackets = (int) ((restData + m_maxPacketSize - 1)/m_maxPacketSize);
|
int restPackets = (int)((restData + m_maxPacketSize - 1) / m_maxPacketSize);
|
||||||
numPackets += restPackets;
|
numPackets += restPackets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,7 +495,7 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
AssetRequest req;
|
AssetRequest req;
|
||||||
for (int i = 0; i < num; i++)
|
for (int i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
req = (AssetRequest) AssetRequests[i];
|
req = (AssetRequest)AssetRequests[i];
|
||||||
//Console.WriteLine("sending asset " + req.RequestAssetID);
|
//Console.WriteLine("sending asset " + req.RequestAssetID);
|
||||||
TransferInfoPacket Transfer = new TransferInfoPacket();
|
TransferInfoPacket Transfer = new TransferInfoPacket();
|
||||||
Transfer.TransferInfo.ChannelType = 2;
|
Transfer.TransferInfo.ChannelType = 2;
|
||||||
|
@ -475,7 +505,7 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
{
|
{
|
||||||
Transfer.TransferInfo.Params = new byte[20];
|
Transfer.TransferInfo.Params = new byte[20];
|
||||||
Array.Copy(req.RequestAssetID.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16);
|
Array.Copy(req.RequestAssetID.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16);
|
||||||
int assType = (int) req.AssetInf.Type;
|
int assType = (int)req.AssetInf.Type;
|
||||||
Array.Copy(Helpers.IntToBytes(assType), 0, Transfer.TransferInfo.Params, 16, 4);
|
Array.Copy(Helpers.IntToBytes(assType), 0, Transfer.TransferInfo.Params, 16, 4);
|
||||||
}
|
}
|
||||||
else if (req.AssetRequestSource == 3)
|
else if (req.AssetRequestSource == 3)
|
||||||
|
@ -485,7 +515,7 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
//Array.Copy(req.RequestUser.AgentId.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16);
|
//Array.Copy(req.RequestUser.AgentId.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16);
|
||||||
//Array.Copy(req.RequestUser.SessionId.GetBytes(), 0, Transfer.TransferInfo.Params, 16, 16);
|
//Array.Copy(req.RequestUser.SessionId.GetBytes(), 0, Transfer.TransferInfo.Params, 16, 16);
|
||||||
}
|
}
|
||||||
Transfer.TransferInfo.Size = (int) req.AssetInf.Data.Length;
|
Transfer.TransferInfo.Size = (int)req.AssetInf.Data.Length;
|
||||||
Transfer.TransferInfo.TransferID = req.TransferRequestID;
|
Transfer.TransferInfo.TransferID = req.TransferRequestID;
|
||||||
req.RequestUser.OutPacket(Transfer, ThrottleOutPacketType.Asset);
|
req.RequestUser.OutPacket(Transfer, ThrottleOutPacketType.Asset);
|
||||||
|
|
||||||
|
|
|
@ -651,6 +651,10 @@ namespace OpenSim
|
||||||
|
|
||||||
switch (command)
|
switch (command)
|
||||||
{
|
{
|
||||||
|
case "clear-assets":
|
||||||
|
m_assetCache.Clear();
|
||||||
|
break;
|
||||||
|
|
||||||
case "set-time":
|
case "set-time":
|
||||||
m_sceneManager.SetCurrentSceneTimePhase(Convert.ToInt32(cmdparams[0]));
|
m_sceneManager.SetCurrentSceneTimePhase(Convert.ToInt32(cmdparams[0]));
|
||||||
break;
|
break;
|
||||||
|
@ -679,6 +683,7 @@ namespace OpenSim
|
||||||
m_console.Notice(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive.");
|
m_console.Notice(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive.");
|
||||||
m_console.Notice(" alert general [Message] - send an alert to all users.");
|
m_console.Notice(" alert general [Message] - send an alert to all users.");
|
||||||
m_console.Notice("backup - trigger a simulator backup");
|
m_console.Notice("backup - trigger a simulator backup");
|
||||||
|
m_console.Notice("clear-assets - clear asset cache");
|
||||||
m_console.Notice("create user - adds a new user");
|
m_console.Notice("create user - adds a new user");
|
||||||
m_console.Notice("change-region [name] - sets the region that many of these commands affect.");
|
m_console.Notice("change-region [name] - sets the region that many of these commands affect.");
|
||||||
m_console.Notice("command-script [filename] - Execute command in a file.");
|
m_console.Notice("command-script [filename] - Execute command in a file.");
|
||||||
|
@ -697,6 +702,7 @@ namespace OpenSim
|
||||||
m_console.Notice("save-xml2 [filename] - save prims to XML using version 2 format");
|
m_console.Notice("save-xml2 [filename] - save prims to XML using version 2 format");
|
||||||
m_console.Notice("script - manually trigger scripts? or script commands?");
|
m_console.Notice("script - manually trigger scripts? or script commands?");
|
||||||
m_console.Notice("set-time [x] - set the current scene time phase");
|
m_console.Notice("set-time [x] - set the current scene time phase");
|
||||||
|
m_console.Notice("show assets - show state of asset cache.");
|
||||||
m_console.Notice("show users - show info about connected users.");
|
m_console.Notice("show users - show info about connected users.");
|
||||||
m_console.Notice("show modules - shows info aboutloaded modules.");
|
m_console.Notice("show modules - shows info aboutloaded modules.");
|
||||||
m_console.Notice("show stats - statistical information for this server not displayed in the client");
|
m_console.Notice("show stats - statistical information for this server not displayed in the client");
|
||||||
|
@ -989,6 +995,10 @@ namespace OpenSim
|
||||||
|
|
||||||
switch (ShowWhat)
|
switch (ShowWhat)
|
||||||
{
|
{
|
||||||
|
case "assets":
|
||||||
|
m_assetCache.ShowState();
|
||||||
|
break;
|
||||||
|
|
||||||
case "users":
|
case "users":
|
||||||
m_console.Notice(
|
m_console.Notice(
|
||||||
String.Format("{0,-16}{1,-16}{2,-37}{3,-16}{4,-22}{5,-16}", "Firstname", "Lastname",
|
String.Format("{0,-16}{1,-16}{2,-37}{3,-16}{4,-22}{5,-16}", "Firstname", "Lastname",
|
||||||
|
|
Loading…
Reference in New Issue