Fixed the asset download problem I think, solution might not be ideal but works for now.

afrisby
MW 2007-08-08 19:51:51 +00:00
parent 6ec523d5e6
commit a137703611
1 changed files with 9 additions and 12 deletions

View File

@ -211,7 +211,6 @@ namespace OpenSim.Framework.Communications.Caches
this.QueueTextures.Enqueue(sender); this.QueueTextures.Enqueue(sender);
} }
} }
} }
/// <summary> /// <summary>
@ -481,7 +480,7 @@ namespace OpenSim.Framework.Communications.Caches
/// </summary> /// </summary>
/// <param name="userInfo"></param> /// <param name="userInfo"></param>
/// <param name="imageID"></param> /// <param name="imageID"></param>
public void AddTextureRequest(IClientAPI userInfo, LLUUID imageID) public void AddTextureRequest(IClientAPI userInfo, LLUUID imageID, uint packetNumber)
{ {
// Console.WriteLine("texture request for " + imageID.ToStringHyphenated()); // Console.WriteLine("texture request for " + imageID.ToStringHyphenated());
//check to see if texture is in local cache, if not request from asset server //check to see if texture is in local cache, if not request from asset server
@ -489,11 +488,11 @@ namespace OpenSim.Framework.Communications.Caches
{ {
this.AvatarRecievedTextures.Add(userInfo.AgentId, new List<LLUUID>()); this.AvatarRecievedTextures.Add(userInfo.AgentId, new List<LLUUID>());
} }
if(this.AvatarRecievedTextures[userInfo.AgentId].Contains(imageID)) /* if(this.AvatarRecievedTextures[userInfo.AgentId].Contains(imageID))
{ {
//Console.WriteLine(userInfo.AgentId +" is requesting a image( "+ imageID+" that has already been sent to them"); //Console.WriteLine(userInfo.AgentId +" is requesting a image( "+ imageID+" that has already been sent to them");
return; return;
} }*/
if (!this.Textures.ContainsKey(imageID)) if (!this.Textures.ContainsKey(imageID))
{ {
if (!this.RequestedTextures.ContainsKey(imageID)) if (!this.RequestedTextures.ContainsKey(imageID))
@ -527,6 +526,10 @@ namespace OpenSim.Framework.Communications.Caches
{ {
req.NumPackets = 1; req.NumPackets = 1;
} }
if (packetNumber != 0)
{
req.PacketCounter = (int)packetNumber;
}
this.TextureRequests.Add(req); this.TextureRequests.Add(req);
} }
@ -653,8 +656,6 @@ namespace OpenSim.Framework.Communications.Caches
{ {
AssetRequest req = request; AssetRequest req = request;
// Console.WriteLine("sending " + req.ImageInfo.FullID); // Console.WriteLine("sending " + req.ImageInfo.FullID);
// if (req.ImageInfo.FullID == new LLUUID("00000000-0000-0000-5005-000000000005"))
if (req.PacketCounter == 0) if (req.PacketCounter == 0)
{ {
//first time for this request so send imagedata packet //first time for this request so send imagedata packet
@ -684,7 +685,7 @@ namespace OpenSim.Framework.Communications.Caches
Array.Copy(req.ImageInfo.Data, 0, im.ImageData.Data, 0, 600); Array.Copy(req.ImageInfo.Data, 0, im.ImageData.Data, 0, 600);
im.ImageID.Codec = 2; im.ImageID.Codec = 2;
req.RequestUser.OutPacket(im); req.RequestUser.OutPacket(im);
//this.SaveAssetToFile("packetheader.dat", im.ImageData.Data);
req.PacketCounter++; req.PacketCounter++;
//req.ImageInfo.last_used = time; //req.ImageInfo.last_used = time;
//System.Console.WriteLine("sent first packet of texture: //System.Console.WriteLine("sent first packet of texture:
@ -693,7 +694,7 @@ namespace OpenSim.Framework.Communications.Caches
} }
else else
{ {
// Console.WriteLine("sending packet" + req.PacketCounter + "for " + req.ImageInfo.FullID.ToStringHyphenated()); //Console.WriteLine("sending packet" + req.PacketCounter + "for " + req.ImageInfo.FullID.ToStringHyphenated());
//send imagepacket //send imagepacket
//more than one packet so split file up //more than one packet so split file up
ImagePacketPacket im = new ImagePacketPacket(); ImagePacketPacket im = new ImagePacketPacket();
@ -704,10 +705,6 @@ namespace OpenSim.Framework.Communications.Caches
im.ImageData.Data = new byte[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.RequestUser.OutPacket(im);
//if (req.PacketCounter == req.NumPackets)
// {
// this.SaveAssetToFile("packet"+req.PacketCounter+".dat", im.ImageData.Data);
//}
req.PacketCounter++; req.PacketCounter++;
//req.ImageInfo.last_used = time; //req.ImageInfo.last_used = time;
//System.Console.WriteLine("sent a packet of texture: "+req.image_info.FullID); //System.Console.WriteLine("sent a packet of texture: "+req.image_info.FullID);