* Two more OutPacket refactors. TextureSender.

* The split image packet sender doesn't like to be refactored (images don't load after it's been refactored), so left that as is for the moment.
0.6.0-stable
Teravus Ovares 2008-05-10 12:45:41 +00:00
parent 536a92ca84
commit b67f88a3a2
4 changed files with 35 additions and 21 deletions

View File

@ -937,6 +937,8 @@ namespace OpenSim.Framework
void SendConfirmXfer(ulong xferID, uint PacketID);
void SendXferRequest(ulong XferID, short AssetType, LLUUID vFileID, byte FilePath, byte[] FileName);
void SendImagePart(ushort numParts, LLUUID ImageUUID, uint ImageSize, byte[] ImageData, byte imageCodec);
byte[] GetThrottlesPacked(float multiplier);

View File

@ -2229,6 +2229,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
newPack.Header.Zerocoded = true;
OutPacket(newPack, ThrottleOutPacketType.Asset);
}
public void SendImagePart(ushort numParts, LLUUID ImageUUID, uint ImageSize, byte[] ImageData, byte imageCodec)
{
ImageDataPacket im = new ImageDataPacket();
im.Header.Reliable = false;
im.ImageID.Packets = numParts;
im.ImageID.ID = ImageUUID;
if (ImageSize > 0)
im.ImageID.Size = ImageSize;
im.ImageData.Data = ImageData;
im.ImageID.Codec = imageCodec;
im.Header.Zerocoded = true;
OutPacket(im, ThrottleOutPacketType.Texture);
}
#endregion
#region Estate Data Sending Methods

View File

@ -150,37 +150,27 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
{
if (NumPackets == 0)
{
ImageDataPacket im = new ImageDataPacket();
im.Header.Reliable = false;
im.ImageID.Packets = 1;
im.ImageID.ID = m_asset.FullID;
im.ImageID.Size = (uint) m_asset.Data.Length;
im.ImageData.Data = m_asset.Data;
im.ImageID.Codec = 2;
im.Header.Zerocoded = true;
RequestUser.OutPacket(im, ThrottleOutPacketType.Texture);
RequestUser.SendImagePart(1, m_asset.FullID, (uint)m_asset.Data.Length, m_asset.Data, 2);
PacketCounter++;
}
else
{
ImageDataPacket im = new ImageDataPacket();
im.Header.Reliable = false;
im.ImageID.Packets = (ushort) (NumPackets);
im.ImageID.ID = m_asset.FullID;
im.ImageID.Size = (uint) m_asset.Data.Length;
im.ImageData.Data = new byte[600];
Array.Copy(m_asset.Data, 0, im.ImageData.Data, 0, 600);
im.ImageID.Codec = 2;
im.Header.Zerocoded = true;
RequestUser.OutPacket(im, ThrottleOutPacketType.Texture);
byte[] ImageData1 = new byte[600];
Array.Copy(m_asset.Data, 0, ImageData1, 0, 600);
RequestUser.SendImagePart((ushort)(NumPackets), m_asset.FullID, (uint)m_asset.Data.Length, ImageData1, 2);
PacketCounter++;
}
}
else
{
// Doesn't like to be refactored...
ImagePacketPacket im = new ImagePacketPacket();
im.Header.Reliable = false;
im.ImageID.Packet = (ushort) (PacketCounter);
im.ImageID.Packet = (ushort)(PacketCounter);
im.ImageID.ID = m_asset.FullID;
int size = m_asset.Data.Length - 600 - (1000 * (PacketCounter - 1));
if (size > 1000) size = 1000;
@ -195,8 +185,9 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
m_asset.FullID.ToString());
return;
}
im.Header.Zerocoded = true;
RequestUser.OutPacket(im, ThrottleOutPacketType.Texture);
PacketCounter++;
}
}

View File

@ -522,13 +522,19 @@ namespace OpenSim.Region.Examples.SimpleModule
public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, LLUUID AssetFullID)
{
}
public void SendConfirmXfer(ulong xferID, uint PacketID)
{
}
public void SendXferRequest(ulong XferID, short AssetType, LLUUID vFileID, byte FilePath, byte[] FileName)
{
}
public void SendImagePart(ushort numParts, LLUUID ImageUUID, uint ImageSize, byte[] ImageData, byte imageCodec)
{
}
private void Update()
{
frame++;