aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorBrian McBee2007-08-27 04:20:14 +0000
committerBrian McBee2007-08-27 04:20:14 +0000
commit6e35ff28227432ff902a7d535b4e141e9406b966 (patch)
treeb44d9c4d969f138eab157ce4d690afb49772850f /OpenSim
parentFixing llList2double issue (Thanks ldvoipeng) (diff)
downloadopensim-SC_OLD-6e35ff28227432ff902a7d535b4e141e9406b966.zip
opensim-SC_OLD-6e35ff28227432ff902a7d535b4e141e9406b966.tar.gz
opensim-SC_OLD-6e35ff28227432ff902a7d535b4e141e9406b966.tar.bz2
opensim-SC_OLD-6e35ff28227432ff902a7d535b4e141e9406b966.tar.xz
Tweaks to assetcache to make texture downloading better (I hope)
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetCache.cs27
1 files changed, 14 insertions, 13 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs
index 4f845b5..d06582e 100644
--- a/OpenSim/Framework/Communications/Cache/AssetCache.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs
@@ -534,7 +534,7 @@ namespace OpenSim.Framework.Communications.Caches
534 /// <param name="imageID"></param> 534 /// <param name="imageID"></param>
535 public void AddTextureRequest(IClientAPI userInfo, LLUUID imageID, uint packetNumber) 535 public void AddTextureRequest(IClientAPI userInfo, LLUUID imageID, uint packetNumber)
536 { 536 {
537 //Console.WriteLine("texture request for " + imageID.ToStringHyphenated()); 537 //Console.WriteLine("texture request for " + imageID.ToStringHyphenated() + " packetnumber= " + packetNumber);
538 //check to see if texture is in local cache, if not request from asset server 538 //check to see if texture is in local cache, if not request from asset server
539 if (!this.AvatarRecievedTextures.ContainsKey(userInfo.AgentId)) 539 if (!this.AvatarRecievedTextures.ContainsKey(userInfo.AgentId))
540 { 540 {
@@ -570,8 +570,9 @@ namespace OpenSim.Framework.Communications.Caches
570 570
571 if (imag.Data.LongLength > 600) 571 if (imag.Data.LongLength > 600)
572 { 572 {
573 //Console.WriteLine("{0}", imag.Data.LongLength);
573 //over 600 bytes so split up file 574 //over 600 bytes so split up file
574 req.NumPackets = 1 + (int)(imag.Data.Length - 600) / 1000; 575 req.NumPackets = 2 + (int)(imag.Data.Length - 601) / 1000;
575 //Console.WriteLine("texture is " + imag.Data.Length + " which we will send in " +req.NumPackets +" packets"); 576 //Console.WriteLine("texture is " + imag.Data.Length + " which we will send in " +req.NumPackets +" packets");
576 } 577 }
577 else 578 else
@@ -698,8 +699,7 @@ namespace OpenSim.Framework.Communications.Caches
698 { 699 {
699 SendPacket(); 700 SendPacket();
700 counter++; 701 counter++;
701 702 if ((request.PacketCounter >= request.NumPackets) | counter > 100 | (request.NumPackets == 1))
702 if ((request.PacketCounter > request.NumPackets) | (counter > 100) | (request.NumPackets == 1))
703 { 703 {
704 return true; 704 return true;
705 } 705 }
@@ -709,13 +709,13 @@ namespace OpenSim.Framework.Communications.Caches
709 public void SendPacket() 709 public void SendPacket()
710 { 710 {
711 AssetRequest req = request; 711 AssetRequest req = request;
712 // Console.WriteLine("sending " + req.ImageInfo.FullID); 712 //Console.WriteLine("sending " + req.ImageInfo.FullID);
713 if (req.PacketCounter == 0) 713 if (req.PacketCounter == 0)
714 { 714 {
715 //first time for this request so send imagedata packet 715 //first time for this request so send imagedata packet
716 if (req.NumPackets == 1) 716 if (req.NumPackets == 1)
717 { 717 {
718 //only one packet so send whole file 718 //Console.WriteLine("only one packet so send whole file");
719 ImageDataPacket im = new ImageDataPacket(); 719 ImageDataPacket im = new ImageDataPacket();
720 im.Header.Reliable = false; 720 im.Header.Reliable = false;
721 im.ImageID.Packets = 1; 721 im.ImageID.Packets = 1;
@@ -727,7 +727,7 @@ namespace OpenSim.Framework.Communications.Caches
727 req.PacketCounter++; 727 req.PacketCounter++;
728 //req.ImageInfo.l= time; 728 //req.ImageInfo.l= time;
729 //System.Console.WriteLine("sent texture: " + req.ImageInfo.FullID); 729 //System.Console.WriteLine("sent texture: " + req.ImageInfo.FullID);
730 // Console.WriteLine("sending packet 1 for " + req.ImageInfo.FullID.ToStringHyphenated()); 730 //Console.WriteLine("sending single packet for " + req.ImageInfo.FullID.ToStringHyphenated());
731 } 731 }
732 else 732 else
733 { 733 {
@@ -744,27 +744,28 @@ namespace OpenSim.Framework.Communications.Caches
744 744
745 req.PacketCounter++; 745 req.PacketCounter++;
746 //req.ImageInfo.last_used = time; 746 //req.ImageInfo.last_used = time;
747 //System.Console.WriteLine("sent first packet of texture: 747 //System.Console.WriteLine("sent first packet of texture: " + req.ImageInfo.FullID);
748 // Console.WriteLine("sending packet 1 for " + req.ImageInfo.FullID.ToStringHyphenated()); 748 //Console.WriteLine("sending packet 1 for " + req.ImageInfo.FullID.ToStringHyphenated());
749 } 749 }
750 } 750 }
751 else 751 else
752 { 752 {
753 //Console.WriteLine("sending packet" + req.PacketCounter + "for " + req.ImageInfo.FullID.ToStringHyphenated()); 753 //Console.WriteLine("sending packet " + req.PacketCounter + " for " + req.ImageInfo.FullID.ToStringHyphenated());
754 //send imagepacket 754 //send imagepacket
755 //more than one packet so split file up 755 //more than one packet so split file up
756 ImagePacketPacket im = new ImagePacketPacket(); 756 ImagePacketPacket im = new ImagePacketPacket();
757 im.Header.Reliable = false; 757 im.Header.Reliable = false;
758 im.ImageID.Packet = (ushort)(req.PacketCounter); 758 im.ImageID.Packet = (ushort)(req.PacketCounter);
759 im.ImageID.ID = req.ImageInfo.FullID; 759 im.ImageID.ID = req.ImageInfo.FullID;
760 int size = req.ImageInfo.Data.Length - 600 - (1000 * (req.PacketCounter - 1)); 760 int size = req.ImageInfo.Data.Length - 600 - (1000 * (req.PacketCounter-1));
761 if (size > 1000) size = 1000; 761 if (size > 1000) size = 1000;
762 //Console.WriteLine("length= {0} counter= {1} size= {2}",req.ImageInfo.Data.Length, req.PacketCounter, size);
762 im.ImageData.Data = new byte[size]; 763 im.ImageData.Data = new byte[size];
763 Array.Copy(req.ImageInfo.Data, 600 + (1000 * (req.PacketCounter - 1)), im.ImageData.Data, 0, size); 764 Array.Copy(req.ImageInfo.Data, 600 + (1000 * (req.PacketCounter-1)), im.ImageData.Data, 0, size);
764 req.RequestUser.OutPacket(im); 765 req.RequestUser.OutPacket(im);
765 req.PacketCounter++; 766 req.PacketCounter++;
766 //req.ImageInfo.last_used = time; 767 //req.ImageInfo.last_used = time;
767 //System.Console.WriteLine("sent a packet of texture: "+req.image_info.FullID); 768 //System.Console.WriteLine("sent a packet of texture: "+req.ImageInfo.FullID);
768 } 769 }
769 770
770 } 771 }