Revert progressive texture patch from r8001 until issues can be addressed
parent
a9988fa6cf
commit
630ce5b264
|
@ -241,11 +241,9 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
|
||||||
{
|
{
|
||||||
ITextureSender sender = null;
|
ITextureSender sender = null;
|
||||||
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
{
|
{
|
||||||
sender = m_queueSenders.Dequeue();
|
sender = m_queueSenders.Dequeue();
|
||||||
|
|
||||||
|
@ -273,21 +271,15 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
|
||||||
|
|
||||||
//m_log.InfoFormat("[TEXTURE] Texture sender queue size: {0}", m_queueSenders.Count());
|
//m_log.InfoFormat("[TEXTURE] Texture sender queue size: {0}", m_queueSenders.Count());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
// TODO: Let users in the sim and those entering it and possibly an external watchdog know what has happened
|
||||||
m_log.ErrorFormat(
|
m_log.ErrorFormat(
|
||||||
"[TEXTURE]: Texture send thread caught exception. The texture send was aborted. Exception is {0}", e);
|
"[TEXTURE]: Texture send thread terminating with exception. PLEASE REBOOT YOUR SIM - TEXTURES WILL NOT BE AVAILABLE UNTIL YOU DO. Exception is {0}",
|
||||||
|
e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
// catch (Exception e)
|
|
||||||
// {
|
|
||||||
// // TODO: Let users in the sim and those entering it and possibly an external watchdog know what has happened
|
|
||||||
// m_log.ErrorFormat(
|
|
||||||
// "[TEXTURE]: Texture send thread terminating with exception. PLEASE REBOOT YOUR SIM - TEXTURES WILL NOT BE AVAILABLE UNTIL YOU DO. Exception is {0}",
|
|
||||||
// e);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when the texture has finished sending.
|
/// Called when the texture has finished sending.
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
using OpenMetaverse.Packets;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
|
|
||||||
|
|
|
@ -56,10 +56,11 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// We will allow the client to request the same texture n times before dropping further requests
|
/// We will allow the client to request the same texture n times before dropping further requests
|
||||||
///
|
///
|
||||||
/// This number contains repeated requests for the same texture at different resolutions (which
|
/// This number includes repeated requests for the same texture at different resolutions (which we don't
|
||||||
/// are handled since r7368). However, this situation should be handled in a more sophisticated way.
|
/// currently handle properly as far as I know). However, this situation should be handled in a more
|
||||||
|
/// sophisticated way.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static readonly int MAX_ALLOWED_TEXTURE_REQUESTS = 15;
|
private static readonly int MAX_ALLOWED_TEXTURE_REQUESTS = 5;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// XXX Also going to limit requests for found textures.
|
/// XXX Also going to limit requests for found textures.
|
||||||
|
@ -148,7 +149,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
|
||||||
|
|
||||||
m_scene.AddPendingDownloads(1);
|
m_scene.AddPendingDownloads(1);
|
||||||
|
|
||||||
TextureSender.TextureSender requestHandler = new TextureSender.TextureSender(m_client, e.DiscardLevel, e.PacketNumber, e.Priority);
|
TextureSender.TextureSender requestHandler = new TextureSender.TextureSender(m_client, e.DiscardLevel, e.PacketNumber);
|
||||||
m_textureSenders.Add(e.RequestedAssetID, requestHandler);
|
m_textureSenders.Add(e.RequestedAssetID, requestHandler);
|
||||||
|
|
||||||
m_scene.AssetCache.GetAsset(e.RequestedAssetID, TextureCallback, true);
|
m_scene.AssetCache.GetAsset(e.RequestedAssetID, TextureCallback, true);
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
|
||||||
agent.startpos = Vector3.Zero;
|
agent.startpos = Vector3.Zero;
|
||||||
agent.CapsPath = "http://wibble.com";
|
agent.CapsPath = "http://wibble.com";
|
||||||
|
|
||||||
new TextureSender(new TestClient(agent), 0, 0, 1.0f);
|
new TextureSender(new TestClient(agent), 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -27,104 +27,13 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using OpenMetaverse.Packets;
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
|
namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
|
||||||
{
|
{
|
||||||
public class ImageDownload
|
|
||||||
{
|
|
||||||
public const int FIRST_IMAGE_PACKET_SIZE = 600;
|
|
||||||
public const int IMAGE_PACKET_SIZE = 1000;
|
|
||||||
|
|
||||||
public OpenMetaverse.AssetTexture Texture;
|
|
||||||
public int DiscardLevel;
|
|
||||||
public float Priority;
|
|
||||||
public int CurrentPacket;
|
|
||||||
public int StopPacket;
|
|
||||||
|
|
||||||
public ImageDownload(OpenMetaverse.AssetTexture texture, int discardLevel, float priority, int packet)
|
|
||||||
{
|
|
||||||
Texture = texture;
|
|
||||||
Update(discardLevel, priority, packet);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Updates an image transfer with new information and recalculates
|
|
||||||
/// offsets
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="discardLevel">New requested discard level</param>
|
|
||||||
/// <param name="priority">New requested priority</param>
|
|
||||||
/// <param name="packet">New requested packet offset</param>
|
|
||||||
public void Update(int discardLevel, float priority, int packet)
|
|
||||||
{
|
|
||||||
Priority = priority;
|
|
||||||
DiscardLevel = Clamp(discardLevel, 0, Texture.LayerInfo.Length - 1);
|
|
||||||
StopPacket = GetPacketForBytePosition(Texture.LayerInfo[(Texture.LayerInfo.Length - 1) - DiscardLevel].End);
|
|
||||||
CurrentPacket = Clamp(packet, 1, TexturePacketCount());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the total number of packets needed to transfer this texture,
|
|
||||||
/// including the first packet of size FIRST_IMAGE_PACKET_SIZE
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Total number of packets needed to transfer this texture</returns>
|
|
||||||
public int TexturePacketCount()
|
|
||||||
{
|
|
||||||
return ((Texture.AssetData.Length - FIRST_IMAGE_PACKET_SIZE + IMAGE_PACKET_SIZE - 1) / IMAGE_PACKET_SIZE) + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the current byte offset for this transfer, calculated from
|
|
||||||
/// the CurrentPacket
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Current byte offset for this transfer</returns>
|
|
||||||
public int CurrentBytePosition()
|
|
||||||
{
|
|
||||||
return FIRST_IMAGE_PACKET_SIZE + (CurrentPacket - 1) * IMAGE_PACKET_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the size, in bytes, of the last packet. This will be somewhere
|
|
||||||
/// between 1 and IMAGE_PACKET_SIZE bytes
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Size of the last packet in the transfer</returns>
|
|
||||||
public int LastPacketSize()
|
|
||||||
{
|
|
||||||
return Texture.AssetData.Length - (FIRST_IMAGE_PACKET_SIZE + ((TexturePacketCount() - 2) * IMAGE_PACKET_SIZE));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Find the packet number that contains a given byte position
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="bytePosition">Byte position</param>
|
|
||||||
/// <returns>Packet number that contains the given byte position</returns>
|
|
||||||
int GetPacketForBytePosition(int bytePosition)
|
|
||||||
{
|
|
||||||
return ((bytePosition - FIRST_IMAGE_PACKET_SIZE + IMAGE_PACKET_SIZE - 1) / IMAGE_PACKET_SIZE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clamp a given value between a range
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="value">Value to clamp</param>
|
|
||||||
/// <param name="min">Minimum allowable value</param>
|
|
||||||
/// <param name="max">Maximum allowable value</param>
|
|
||||||
/// <returns>A value inclusively between lower and upper</returns>
|
|
||||||
static int Clamp(int value, int min, int max)
|
|
||||||
{
|
|
||||||
// First we check to see if we're greater than the max
|
|
||||||
value = (value > max) ? max : value;
|
|
||||||
|
|
||||||
// Then we check to see if we're less than the min.
|
|
||||||
value = (value < min) ? min : value;
|
|
||||||
|
|
||||||
// There's no check to see if min > max.
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A TextureSender handles the process of receiving a texture requested by the client from the
|
/// A TextureSender handles the process of receiving a texture requested by the client from the
|
||||||
/// AssetCache, and then sending that texture back to the client.
|
/// AssetCache, and then sending that texture back to the client.
|
||||||
|
@ -134,81 +43,90 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
|
||||||
private static readonly ILog m_log
|
private static readonly ILog m_log
|
||||||
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Records the number of times texture send has been called.
|
||||||
|
/// </summary>
|
||||||
|
public int counter = 0;
|
||||||
|
|
||||||
public bool ImageLoaded = false;
|
public bool ImageLoaded = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Holds the texture asset to send.
|
/// Holds the texture asset to send.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private AssetBase m_asset;
|
private AssetBase m_asset;
|
||||||
private bool m_cancel = false;
|
|
||||||
private bool m_sending = false;
|
|
||||||
private bool sendFirstPacket = false;
|
|
||||||
private int initialDiscardLevel = 0;
|
|
||||||
private int initialPacketNum = 0;
|
|
||||||
private float initialPriority = 0.0f;
|
|
||||||
|
|
||||||
private ImageDownload download;
|
//public UUID assetID { get { return m_asset.FullID; } }
|
||||||
|
|
||||||
|
// private bool m_cancel = false;
|
||||||
|
|
||||||
|
// See ITextureSender
|
||||||
|
|
||||||
|
// private bool m_sending = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This is actually the number of extra packets required to send the texture data! We always assume
|
||||||
|
/// at least one is required.
|
||||||
|
/// </summary>
|
||||||
|
private int NumPackets = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Holds the packet number to send next. In this case, each packet is 1000 bytes long and starts
|
||||||
|
/// at the 600th byte (0th indexed).
|
||||||
|
/// </summary>
|
||||||
|
private int PacketCounter = 0;
|
||||||
|
|
||||||
|
private int RequestedDiscardLevel = -1;
|
||||||
private IClientAPI RequestUser;
|
private IClientAPI RequestUser;
|
||||||
|
private uint StartPacketNumber = 0;
|
||||||
|
|
||||||
public TextureSender(IClientAPI client, int discardLevel, uint packetNumber, float priority)
|
public TextureSender(IClientAPI client, int discardLevel, uint packetNumber)
|
||||||
{
|
{
|
||||||
RequestUser = client;
|
RequestUser = client;
|
||||||
initialDiscardLevel = discardLevel;
|
RequestedDiscardLevel = discardLevel;
|
||||||
initialPacketNum = (int)packetNumber;
|
StartPacketNumber = packetNumber;
|
||||||
initialPriority = priority;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region ITextureSender Members
|
#region ITextureSender Members
|
||||||
|
|
||||||
public bool Cancel
|
public bool Cancel
|
||||||
{
|
{
|
||||||
get { return m_cancel; }
|
get { return false; }
|
||||||
set { m_cancel = value; }
|
set
|
||||||
|
{
|
||||||
|
// m_cancel = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Sending
|
public bool Sending
|
||||||
{
|
{
|
||||||
get { return m_sending; }
|
get { return false; }
|
||||||
set { m_sending = value; }
|
set
|
||||||
|
{
|
||||||
|
// m_sending = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// See ITextureSender
|
// See ITextureSender
|
||||||
public void UpdateRequest(int discardLevel, uint packetNumber)
|
public void UpdateRequest(int discardLevel, uint packetNumber)
|
||||||
{
|
{
|
||||||
if (download == null)
|
RequestedDiscardLevel = discardLevel;
|
||||||
return;
|
StartPacketNumber = packetNumber;
|
||||||
|
PacketCounter = (int)StartPacketNumber;
|
||||||
lock (download)
|
|
||||||
{
|
|
||||||
if (discardLevel < download.DiscardLevel)
|
|
||||||
m_log.DebugFormat("Image download {0} is changing from DiscardLevel {1} to {2}",
|
|
||||||
m_asset.FullID, download.DiscardLevel, discardLevel);
|
|
||||||
|
|
||||||
if (packetNumber != download.CurrentPacket)
|
|
||||||
m_log.DebugFormat("Image download {0} is changing from Packet {1} to {2}",
|
|
||||||
m_asset.FullID, download.CurrentPacket, packetNumber);
|
|
||||||
|
|
||||||
download.Update(discardLevel, download.Priority, (int)packetNumber);
|
|
||||||
|
|
||||||
sendFirstPacket = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// See ITextureSender
|
// See ITextureSender
|
||||||
public bool SendTexturePacket()
|
public bool SendTexturePacket()
|
||||||
{
|
{
|
||||||
if (download != null && !m_cancel && (sendFirstPacket || download.CurrentPacket <= download.StopPacket))
|
//m_log.DebugFormat("[TEXTURE SENDER]: Sending packet for {0}", m_asset.FullID);
|
||||||
{
|
|
||||||
SendPacket();
|
SendPacket();
|
||||||
return false;
|
counter++;
|
||||||
}
|
if ((NumPackets == 0) || (RequestedDiscardLevel == -1) || (PacketCounter > NumPackets) ||
|
||||||
else
|
((RequestedDiscardLevel > 0) && (counter > 50 + (NumPackets / (RequestedDiscardLevel + 1)))))
|
||||||
{
|
{
|
||||||
m_sending = false;
|
|
||||||
m_cancel = true;
|
|
||||||
sendFirstPacket = false;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -220,52 +138,9 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
|
||||||
public void TextureReceived(AssetBase asset)
|
public void TextureReceived(AssetBase asset)
|
||||||
{
|
{
|
||||||
m_asset = asset;
|
m_asset = asset;
|
||||||
|
NumPackets = CalculateNumPackets(asset.Data.Length);
|
||||||
try
|
PacketCounter = (int)StartPacketNumber;
|
||||||
{
|
|
||||||
OpenMetaverse.AssetTexture texture = new OpenMetaverse.AssetTexture(m_asset.FullID, m_asset.Data);
|
|
||||||
if (texture.DecodeLayerBoundaries())
|
|
||||||
{
|
|
||||||
bool sane = true;
|
|
||||||
|
|
||||||
// Sanity check all of the layers
|
|
||||||
for (int i = 0; i < texture.LayerInfo.Length; i++)
|
|
||||||
{
|
|
||||||
if (texture.LayerInfo[i].End > texture.AssetData.Length)
|
|
||||||
{
|
|
||||||
sane = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sane)
|
|
||||||
{
|
|
||||||
download = new ImageDownload(texture, initialDiscardLevel, initialPriority, initialPacketNum);
|
|
||||||
ImageLoaded = true;
|
ImageLoaded = true;
|
||||||
m_sending = true;
|
|
||||||
m_cancel = false;
|
|
||||||
sendFirstPacket = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.Error("JPEG2000 texture decoding succeeded, but sanity check failed for " +
|
|
||||||
m_asset.FullID.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.Error("JPEG2000 texture decoding failed for " + m_asset.FullID.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
m_log.Error("JPEG2000 texture decoding threw an exception for " + m_asset.FullID.ToString(), ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
ImageLoaded = false;
|
|
||||||
m_sending = false;
|
|
||||||
m_cancel = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -273,48 +148,66 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void SendPacket()
|
private void SendPacket()
|
||||||
{
|
{
|
||||||
lock (download)
|
if (PacketCounter <= NumPackets)
|
||||||
{
|
{
|
||||||
if (sendFirstPacket)
|
if (PacketCounter == 0)
|
||||||
{
|
{
|
||||||
sendFirstPacket = false;
|
if (NumPackets == 0)
|
||||||
|
|
||||||
if (m_asset.Data.Length <= ImageDownload.FIRST_IMAGE_PACKET_SIZE)
|
|
||||||
{
|
{
|
||||||
RequestUser.SendImageFirstPart(1, m_asset.FullID, (uint)m_asset.Data.Length, m_asset.Data, 2);
|
RequestUser.SendImageFirstPart(1, m_asset.FullID, (uint)m_asset.Data.Length, m_asset.Data, 2);
|
||||||
return;
|
PacketCounter++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
byte[] firstImageData = new byte[ImageDownload.FIRST_IMAGE_PACKET_SIZE];
|
byte[] ImageData1 = new byte[600];
|
||||||
try { Buffer.BlockCopy(m_asset.Data, 0, firstImageData, 0, ImageDownload.FIRST_IMAGE_PACKET_SIZE); }
|
Array.Copy(m_asset.Data, 0, ImageData1, 0, 600);
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
m_log.Error("Texture data copy failed on first packet for " + m_asset.FullID.ToString());
|
|
||||||
m_cancel = true;
|
|
||||||
m_sending = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
RequestUser.SendImageFirstPart((ushort)download.TexturePacketCount(), m_asset.FullID, (uint)m_asset.Data.Length, firstImageData, 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int imagePacketSize = (download.CurrentPacket == download.TexturePacketCount() - 1) ?
|
RequestUser.SendImageFirstPart(
|
||||||
download.LastPacketSize() : ImageDownload.IMAGE_PACKET_SIZE;
|
(ushort)(NumPackets), m_asset.FullID, (uint)m_asset.Data.Length, ImageData1, 2);
|
||||||
|
PacketCounter++;
|
||||||
byte[] imageData = new byte[imagePacketSize];
|
}
|
||||||
try { Buffer.BlockCopy(m_asset.Data, download.CurrentBytePosition(), imageData, 0, imagePacketSize); }
|
}
|
||||||
catch (Exception)
|
else
|
||||||
{
|
{
|
||||||
m_log.Error("Texture data copy failed for " + m_asset.FullID.ToString());
|
int size = m_asset.Data.Length - 600 - (1000 * (PacketCounter - 1));
|
||||||
m_cancel = true;
|
if (size > 1000) size = 1000;
|
||||||
m_sending = false;
|
byte[] imageData = new byte[size];
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Array.Copy(m_asset.Data, 600 + (1000 * (PacketCounter - 1)), imageData, 0, size);
|
||||||
|
}
|
||||||
|
catch (ArgumentOutOfRangeException)
|
||||||
|
{
|
||||||
|
m_log.Error("[TEXTURE SENDER]: Unable to separate texture into multiple packets: Array bounds failure on asset:" +
|
||||||
|
m_asset.FullID.ToString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RequestUser.SendImageNextPart((ushort)download.CurrentPacket, m_asset.FullID, imageData);
|
RequestUser.SendImageNextPart((ushort)PacketCounter, m_asset.FullID, imageData);
|
||||||
++download.CurrentPacket;
|
PacketCounter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Calculate the number of packets that will be required to send the texture loaded into this sender
|
||||||
|
/// This is actually the number of 1000 byte packets not including an initial 600 byte packet...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="length"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private int CalculateNumPackets(int length)
|
||||||
|
{
|
||||||
|
int numPackets = 0;
|
||||||
|
|
||||||
|
if (length > 600)
|
||||||
|
{
|
||||||
|
//over 600 bytes so split up file
|
||||||
|
int restData = (length - 600);
|
||||||
|
int restPackets = ((restData + 999) / 1000);
|
||||||
|
numPackets = restPackets;
|
||||||
|
}
|
||||||
|
|
||||||
|
return numPackets;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
using OpenMetaverse.Packets;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using Nwc.XmlRpc;
|
using Nwc.XmlRpc;
|
||||||
|
@ -491,7 +492,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
||||||
// If new friend is local, it will send an IM to the viewer.
|
// If new friend is local, it will send an IM to the viewer.
|
||||||
// If new friend is remote, it will cause a OnGridInstantMessage on the remote server
|
// If new friend is remote, it will cause a OnGridInstantMessage on the remote server
|
||||||
m_TransferModule.SendInstantMessage(msg,
|
m_TransferModule.SendInstantMessage(msg,
|
||||||
delegate(bool success) {
|
delegate(bool success)
|
||||||
|
{
|
||||||
m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success);
|
m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -510,7 +512,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
||||||
{
|
{
|
||||||
// this should succeed as we *know* the root agent is here.
|
// this should succeed as we *know* the root agent is here.
|
||||||
m_TransferModule.SendInstantMessage(msg,
|
m_TransferModule.SendInstantMessage(msg,
|
||||||
delegate(bool success) {
|
delegate(bool success)
|
||||||
|
{
|
||||||
m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success);
|
m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -609,7 +612,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
||||||
if (m_TransferModule != null)
|
if (m_TransferModule != null)
|
||||||
{
|
{
|
||||||
m_TransferModule.SendInstantMessage(msg,
|
m_TransferModule.SendInstantMessage(msg,
|
||||||
delegate(bool success) {
|
delegate(bool success)
|
||||||
|
{
|
||||||
m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success);
|
m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -633,7 +637,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
||||||
if (m_TransferModule != null)
|
if (m_TransferModule != null)
|
||||||
{
|
{
|
||||||
m_TransferModule.SendInstantMessage(msg,
|
m_TransferModule.SendInstantMessage(msg,
|
||||||
delegate(bool success) {
|
delegate(bool success)
|
||||||
|
{
|
||||||
m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success);
|
m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -31,6 +31,7 @@ using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
using OpenMetaverse.Packets;
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
|
|
|
@ -544,21 +544,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
Evidence baseEvidence = AppDomain.CurrentDomain.Evidence;
|
Evidence baseEvidence = AppDomain.CurrentDomain.Evidence;
|
||||||
Evidence evidence = new Evidence(baseEvidence);
|
Evidence evidence = new Evidence(baseEvidence);
|
||||||
|
|
||||||
AppDomain sandbox =
|
m_AppDomains[appDomain] =
|
||||||
AppDomain.CreateDomain(
|
AppDomain.CreateDomain(
|
||||||
m_Scene.RegionInfo.RegionID.ToString(),
|
m_Scene.RegionInfo.RegionID.ToString(),
|
||||||
evidence, appSetup);
|
evidence, appSetup);
|
||||||
|
|
||||||
PolicyLevel sandboxPolicy = PolicyLevel.CreateAppDomainLevel();
|
|
||||||
AllMembershipCondition sandboxMembershipCondition = new AllMembershipCondition();
|
|
||||||
PermissionSet sandboxPermissionSet = sandboxPolicy.GetNamedPermissionSet("Internet");
|
|
||||||
PolicyStatement sandboxPolicyStatement = new PolicyStatement(sandboxPermissionSet);
|
|
||||||
CodeGroup sandboxCodeGroup = new UnionCodeGroup(sandboxMembershipCondition, sandboxPolicyStatement);
|
|
||||||
sandboxPolicy.RootCodeGroup = sandboxCodeGroup;
|
|
||||||
sandbox.SetAppDomainPolicy(sandboxPolicy);
|
|
||||||
|
|
||||||
m_AppDomains[appDomain] = sandbox;
|
|
||||||
|
|
||||||
m_AppDomains[appDomain].AssemblyResolve +=
|
m_AppDomains[appDomain].AssemblyResolve +=
|
||||||
new ResolveEventHandler(
|
new ResolveEventHandler(
|
||||||
AssemblyResolver.OnAssemblyResolve);
|
AssemblyResolver.OnAssemblyResolve);
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue