aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorgareth2007-02-28 19:47:05 +0000
committergareth2007-02-28 19:47:05 +0000
commitb714801f415860179198776043c5078530d5f804 (patch)
tree3ced3bae5119a598ff6a0a2c9ed537d4614ad5d4
parentGot LayerData working, need asset management to get the avatar to display (diff)
downloadopensim-SC-b714801f415860179198776043c5078530d5f804.zip
opensim-SC-b714801f415860179198776043c5078530d5f804.tar.gz
opensim-SC-b714801f415860179198776043c5078530d5f804.tar.bz2
opensim-SC-b714801f415860179198776043c5078530d5f804.tar.xz
Assets?
Diffstat (limited to '')
-rw-r--r--src/OpenSimClient.cs32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/OpenSimClient.cs b/src/OpenSimClient.cs
index b430c3e..f9349db 100644
--- a/src/OpenSimClient.cs
+++ b/src/OpenSimClient.cs
@@ -51,6 +51,7 @@ namespace OpenSim
51 private Thread ClientThread; 51 private Thread ClientThread;
52 private EndPoint userEP; 52 private EndPoint userEP;
53 private BlockingQueue<QueItem> PacketQueue; 53 private BlockingQueue<QueItem> PacketQueue;
54 private BlockingQueue<TransferRequestPacket> AssetRequests;
54 private Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>(); 55 private Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>();
55 private Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>(); 56 private Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>();
56 private System.Timers.Timer AckTimer; 57 private System.Timers.Timer AckTimer;
@@ -77,6 +78,28 @@ namespace OpenSim
77 } 78 }
78 } 79 }
79 80
81 public void AssetLoader() {
82 Console.WriteLine("OpenSimClient.cs:AssetLoader() - Starting new thread");
83 TransferRequestPacket reqPacket = AssetRequests.Dequeue();
84 Console.WriteLine("OpenSimClient.cs:AssetLoader() - Got a request, processing it");
85 LLUUID AssetID = new LLUUID(reqPacket.TransferInfo.Params, 0);
86 WebRequest AssetLoad = WebRequest.Create(OpenSim_Main.cfg.AssetURL + "getasset/" + OpenSim_Main.cfg.AssetSendKey + "/" + AssetID + "/data");
87 WebResponse AssetResponse = AssetLoad.GetResponse();
88 byte[] idata = new byte[(int)AssetResponse.ContentLength];
89 BinaryReader br = new BinaryReader(AssetResponse.GetResponseStream());
90 idata = br.ReadBytes((int)AssetResponse.ContentLength);
91 br.Close();
92 AssetResponse.Close();
93
94 TransferInfoPacket Transfer = new TransferInfoPacket();
95 Transfer.TransferInfo.ChannelType = 2;
96 Transfer.TransferInfo.Status = 0;
97 Transfer.TransferInfo.TargetType = 0;
98 Transfer.TransferInfo.Params = reqPacket.TransferInfo.Params;
99 Transfer.TransferInfo.Size = (int)AssetResponse.ContentLength;
100 Transfer.TransferInfo.TransferID = reqPacket.TransferInfo.TransferID;
101 }
102
80 public void ProcessInPacket(Packet Pack) { 103 public void ProcessInPacket(Packet Pack) {
81 ack_pack(Pack); 104 ack_pack(Pack);
82 switch(Pack.Type) { 105 switch(Pack.Type) {
@@ -86,6 +109,14 @@ namespace OpenSim
86 case PacketType.RegionHandshakeReply: 109 case PacketType.RegionHandshakeReply:
87 OpenSim_Main.local_world.SendLayerData(this); 110 OpenSim_Main.local_world.SendLayerData(this);
88 break; 111 break;
112 case PacketType.TransferRequest:
113 // We put transfer requests into a big queue and then spawn a thread for each new one
114 TransferRequestPacket transfer = (TransferRequestPacket)Pack;
115 AssetRequests.Enqueue(transfer);
116 Thread AssetLoaderThread = new Thread(new ThreadStart(AssetLoader));
117 AssetLoaderThread.IsBackground = true;
118 AssetLoaderThread.Start();
119 break;
89 } 120 }
90 } 121 }
91 122
@@ -284,6 +315,7 @@ namespace OpenSim
284 cirpack = initialcirpack; 315 cirpack = initialcirpack;
285 userEP = remoteEP; 316 userEP = remoteEP;
286 PacketQueue = new BlockingQueue<QueItem>(); 317 PacketQueue = new BlockingQueue<QueItem>();
318 AssetRequests = new BlockingQueue<TransferRequestPacket>();
287 AckTimer = new System.Timers.Timer(500); 319 AckTimer = new System.Timers.Timer(500);
288 AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); 320 AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed);
289 AckTimer.Start(); 321 AckTimer.Start();