aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
diff options
context:
space:
mode:
authorTeravus Ovares2008-06-18 23:04:15 +0000
committerTeravus Ovares2008-06-18 23:04:15 +0000
commitcb29926e3cefedd9bea3c26b1b7f079c8209f6fa (patch)
treebbf08176c4257299b825d899960f750266b4df1a /OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
parentcommit justin's grafitti board to the base OpenSim script (diff)
downloadopensim-SC_OLD-cb29926e3cefedd9bea3c26b1b7f079c8209f6fa.zip
opensim-SC_OLD-cb29926e3cefedd9bea3c26b1b7f079c8209f6fa.tar.gz
opensim-SC_OLD-cb29926e3cefedd9bea3c26b1b7f079c8209f6fa.tar.bz2
opensim-SC_OLD-cb29926e3cefedd9bea3c26b1b7f079c8209f6fa.tar.xz
* Refactors call to OutPacket out of AssetCache and into LLClientView
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs76
1 files changed, 76 insertions, 0 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index ea2831c..b298578 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -6242,6 +6242,82 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6242 OutPacket(lsrp, ThrottleOutPacketType.Task); 6242 OutPacket(lsrp, ThrottleOutPacketType.Task);
6243 } 6243 }
6244 6244
6245 public void SendAsset(AssetRequestToClient req)
6246 {
6247
6248 //Console.WriteLine("sending asset " + req.RequestAssetID);
6249 TransferInfoPacket Transfer = new TransferInfoPacket();
6250 Transfer.TransferInfo.ChannelType = 2;
6251 Transfer.TransferInfo.Status = 0;
6252 Transfer.TransferInfo.TargetType = 0;
6253 if (req.AssetRequestSource == 2)
6254 {
6255 Transfer.TransferInfo.Params = new byte[20];
6256 Array.Copy(req.RequestAssetID.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16);
6257 int assType = (int)req.AssetInf.Type;
6258 Array.Copy(Helpers.IntToBytes(assType), 0, Transfer.TransferInfo.Params, 16, 4);
6259 }
6260 else if (req.AssetRequestSource == 3)
6261 {
6262 Transfer.TransferInfo.Params = req.Params;
6263 // Transfer.TransferInfo.Params = new byte[100];
6264 //Array.Copy(req.RequestUser.AgentId.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16);
6265 //Array.Copy(req.RequestUser.SessionId.GetBytes(), 0, Transfer.TransferInfo.Params, 16, 16);
6266 }
6267 Transfer.TransferInfo.Size = (int)req.AssetInf.Data.Length;
6268 Transfer.TransferInfo.TransferID = req.TransferRequestID;
6269 Transfer.Header.Zerocoded = true;
6270 OutPacket(Transfer, ThrottleOutPacketType.Asset);
6271
6272 if (req.NumPackets == 1)
6273 {
6274 TransferPacketPacket TransferPacket = new TransferPacketPacket();
6275 TransferPacket.TransferData.Packet = 0;
6276 TransferPacket.TransferData.ChannelType = 2;
6277 TransferPacket.TransferData.TransferID = req.TransferRequestID;
6278 TransferPacket.TransferData.Data = req.AssetInf.Data;
6279 TransferPacket.TransferData.Status = 1;
6280 TransferPacket.Header.Zerocoded = true;
6281 OutPacket(TransferPacket, ThrottleOutPacketType.Asset);
6282 }
6283 else
6284 {
6285 int processedLength = 0;
6286 // libsecondlife hardcodes 1500 as the maximum data chunk size
6287 int maxChunkSize = 1250;
6288 int packetNumber = 0;
6289
6290 while (processedLength < req.AssetInf.Data.Length)
6291 {
6292 TransferPacketPacket TransferPacket = new TransferPacketPacket();
6293 TransferPacket.TransferData.Packet = packetNumber;
6294 TransferPacket.TransferData.ChannelType = 2;
6295 TransferPacket.TransferData.TransferID = req.TransferRequestID;
6296
6297 int chunkSize = Math.Min(req.AssetInf.Data.Length - processedLength, maxChunkSize);
6298 byte[] chunk = new byte[chunkSize];
6299 Array.Copy(req.AssetInf.Data, processedLength, chunk, 0, chunk.Length);
6300
6301 TransferPacket.TransferData.Data = chunk;
6302
6303 // 0 indicates more packets to come, 1 indicates last packet
6304 if (req.AssetInf.Data.Length - processedLength > maxChunkSize)
6305 {
6306 TransferPacket.TransferData.Status = 0;
6307 }
6308 else
6309 {
6310 TransferPacket.TransferData.Status = 1;
6311 }
6312 TransferPacket.Header.Zerocoded = true;
6313 OutPacket(TransferPacket, ThrottleOutPacketType.Asset);
6314
6315 processedLength += chunkSize;
6316 packetNumber++;
6317 }
6318 }
6319 }
6320
6245 public ClientInfo GetClientInfo() 6321 public ClientInfo GetClientInfo()
6246 { 6322 {
6247 //MainLog.Instance.Verbose("CLIENT", "GetClientInfo BGN"); 6323 //MainLog.Instance.Verbose("CLIENT", "GetClientInfo BGN");