aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs21
1 files changed, 20 insertions, 1 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
index 97e6bbe..6e81632 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
@@ -580,7 +580,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
580 // Console.WriteLine("ENdPacket"); 580 // Console.WriteLine("ENdPacket");
581 //Console.WriteLine(String.Format("srcLen:{0}, BytePos:{1}, desLen:{2}, pktsize{3}", m_asset_ref.Data.Length, CurrentBytePosition(),0, imagePacketSize)); 581 //Console.WriteLine(String.Format("srcLen:{0}, BytePos:{1}, desLen:{2}, pktsize{3}", m_asset_ref.Data.Length, CurrentBytePosition(),0, imagePacketSize));
582 582
583 583 bool atEnd = false;
584
585 // edge case
586 if ((CurrentBytePosition() + IMAGE_PACKET_SIZE) > m_asset_ref.Data.Length)
587 {
588 imagePacketSize = LastPacketSize();
589 atEnd = true;
590 // edge case 2!
591 if ((CurrentBytePosition() + imagePacketSize) > m_asset_ref.Data.Length)
592 {
593 imagePacketSize = m_asset_ref.Data.Length - CurrentBytePosition();
594 atEnd = true;
595 }
596 }
597
584 byte[] imageData = new byte[imagePacketSize]; 598 byte[] imageData = new byte[imagePacketSize];
585 try { Buffer.BlockCopy(m_asset_ref.Data, CurrentBytePosition(), imageData, 0, imagePacketSize); } 599 try { Buffer.BlockCopy(m_asset_ref.Data, CurrentBytePosition(), imageData, 0, imagePacketSize); }
586 catch (Exception e) 600 catch (Exception e)
@@ -596,7 +610,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
596 610
597 // Send next packet to the client 611 // Send next packet to the client
598 client.SendImageNextPart((ushort)(CurrentPacket - 1), requestedUUID, imageData); 612 client.SendImageNextPart((ushort)(CurrentPacket - 1), requestedUUID, imageData);
613
599 ++CurrentPacket; 614 ++CurrentPacket;
615
616 if (atEnd)
617 CurrentPacket = StopPacket + 1;
618
600 return true; 619 return true;
601 } 620 }
602 621