aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetCache.cs47
1 files changed, 36 insertions, 11 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs
index c164f0c..3edc7eb 100644
--- a/OpenSim/Framework/Communications/Cache/AssetCache.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs
@@ -94,8 +94,8 @@ namespace OpenSim.Framework.Communications.Cache
94 Thread.Sleep(500); 94 Thread.Sleep(500);
95 } 95 }
96 catch (Exception e) 96 catch (Exception e)
97 { 97 {
98 System.Console.WriteLine(e.Message + " : " + e.StackTrace); 98 m_log.Error("ASSETCACHE", e.ToString());
99 } 99 }
100 } 100 }
101 } 101 }
@@ -492,15 +492,40 @@ namespace OpenSim.Framework.Communications.Cache
492 TransferPacket.TransferData.Status = 0; 492 TransferPacket.TransferData.Status = 0;
493 req.RequestUser.OutPacket(TransferPacket, ThrottleOutPacketType.Asset); 493 req.RequestUser.OutPacket(TransferPacket, ThrottleOutPacketType.Asset);
494 494
495 TransferPacket = new TransferPacketPacket(); 495 int processedLength = 1000;
496 TransferPacket.TransferData.Packet = 1; 496 // libsecondlife tells us that the largest allowable chunk is 1500 bytes
497 TransferPacket.TransferData.ChannelType = 2; 497 // XXX Fix up this magic number (and others)!
498 TransferPacket.TransferData.TransferID = req.TransferRequestID; 498 int maxChunkSize = 1500;
499 byte[] chunk1 = new byte[(req.AssetInf.Data.Length - 1000)]; 499 int packetNumber = 1;
500 Array.Copy(req.AssetInf.Data, 1000, chunk1, 0, chunk1.Length); 500
501 TransferPacket.TransferData.Data = chunk1; 501 while (processedLength < req.AssetInf.Data.Length)
502 TransferPacket.TransferData.Status = 1; 502 {
503 req.RequestUser.OutPacket(TransferPacket, ThrottleOutPacketType.Asset); 503 TransferPacket = new TransferPacketPacket();
504 TransferPacket.TransferData.Packet = packetNumber;
505 TransferPacket.TransferData.ChannelType = 2;
506 TransferPacket.TransferData.TransferID = req.TransferRequestID;
507
508 int chunkSize = Math.Min(req.AssetInf.Data.Length - processedLength, maxChunkSize);
509 byte[] chunk1 = new byte[chunkSize];
510 Array.Copy(req.AssetInf.Data, processedLength, chunk1, 0, chunk1.Length);
511
512 TransferPacket.TransferData.Data = chunk1;
513
514 // 0 indicates more packets to come, 1 indicates last packet
515 if (req.AssetInf.Data.Length - processedLength > maxChunkSize)
516 {
517 TransferPacket.TransferData.Status = 0;
518 }
519 else
520 {
521 TransferPacket.TransferData.Status = 1;
522 }
523
524 req.RequestUser.OutPacket(TransferPacket, ThrottleOutPacketType.Asset);
525
526 processedLength += chunkSize;
527 packetNumber++;
528 }
504 } 529 }
505 } 530 }
506 } 531 }