aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
diff options
context:
space:
mode:
authorMW2007-12-07 22:47:11 +0000
committerMW2007-12-07 22:47:11 +0000
commit87b337ebf9f36ca3b2af94631ec9a235434877ac (patch)
tree19e83a62d69abc389268b0db07f816bd817908d9 /OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
parent"Borrowed" the LLSD class from a older version of libsl, so that our LLSD dec... (diff)
downloadopensim-SC-87b337ebf9f36ca3b2af94631ec9a235434877ac.zip
opensim-SC-87b337ebf9f36ca3b2af94631ec9a235434877ac.tar.gz
opensim-SC-87b337ebf9f36ca3b2af94631ec9a235434877ac.tar.bz2
opensim-SC-87b337ebf9f36ca3b2af94631ec9a235434877ac.tar.xz
Enabled the TextureDownloadModule, so that hopefully I might get some feedback, as to if it makes the texture problem better or worse. As I plan/hope to work on texture/asset downloading this weekend.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/TextureDownloadModule.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/TextureDownloadModule.cs31
1 files changed, 16 insertions, 15 deletions
diff --git a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
index 902b669..66cdec7 100644
--- a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
+++ b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
@@ -27,6 +27,7 @@
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Threading;
30using libsecondlife; 31using libsecondlife;
31using libsecondlife.Packets; 32using libsecondlife.Packets;
32using Nini.Config; 33using Nini.Config;
@@ -50,13 +51,13 @@ namespace OpenSim.Region.Environment.Modules
50 51
51 private BlockingQueue<TextureSender> QueueSenders = new BlockingQueue<TextureSender>(); 52 private BlockingQueue<TextureSender> QueueSenders = new BlockingQueue<TextureSender>();
52 private Dictionary<LLUUID, List<LLUUID>> InProcess = new Dictionary<LLUUID, List<LLUUID>>(); 53 private Dictionary<LLUUID, List<LLUUID>> InProcess = new Dictionary<LLUUID, List<LLUUID>>();
53 // private Thread m_thread; 54 private Thread m_thread;
54 55
55 public TextureDownloadModule() 56 public TextureDownloadModule()
56 { 57 {
57 // m_thread = new Thread(new ThreadStart(ProcessTextureSenders)); 58 m_thread = new Thread(new ThreadStart(ProcessTextureSenders));
58 // m_thread.IsBackground = true; 59 m_thread.IsBackground = true;
59 // m_thread.Start(); 60 m_thread.Start();
60 } 61 }
61 62
62 public void Initialise(Scene scene, IConfigSource config) 63 public void Initialise(Scene scene, IConfigSource config)
@@ -89,7 +90,7 @@ namespace OpenSim.Region.Environment.Modules
89 90
90 public void NewClient(IClientAPI client) 91 public void NewClient(IClientAPI client)
91 { 92 {
92 /* lock (ClientRequests) 93 lock (ClientRequests)
93 { 94 {
94 if (!ClientRequests.ContainsKey(client.AgentId)) 95 if (!ClientRequests.ContainsKey(client.AgentId))
95 { 96 {
@@ -98,7 +99,7 @@ namespace OpenSim.Region.Environment.Modules
98 } 99 }
99 } 100 }
100 client.OnRequestTexture += TextureRequest; 101 client.OnRequestTexture += TextureRequest;
101 */ 102
102 } 103 }
103 104
104 public void TextureCallback(LLUUID textureID, AssetBase asset) 105 public void TextureCallback(LLUUID textureID, AssetBase asset)
@@ -124,7 +125,7 @@ namespace OpenSim.Region.Environment.Modules
124 125
125 public void TextureRequest(Object sender, TextureRequestArgs e) 126 public void TextureRequest(Object sender, TextureRequestArgs e)
126 { 127 {
127 IClientAPI client = (IClientAPI) sender; 128 IClientAPI client = (IClientAPI)sender;
128 if (!ClientRequests[client.AgentId].ContainsKey(e.RequestedAssetID)) 129 if (!ClientRequests[client.AgentId].ContainsKey(e.RequestedAssetID))
129 { 130 {
130 lock (ClientRequests) 131 lock (ClientRequests)
@@ -177,14 +178,14 @@ namespace OpenSim.Region.Environment.Modules
177 178
178 if (asset.Data.LongLength > 600) 179 if (asset.Data.LongLength > 600)
179 { 180 {
180 NumPackets = 2 + (int) (asset.Data.Length - 601)/1000; 181 NumPackets = 2 + (int)(asset.Data.Length - 601) / 1000;
181 } 182 }
182 else 183 else
183 { 184 {
184 NumPackets = 1; 185 NumPackets = 1;
185 } 186 }
186 187
187 PacketCounter = (int) req.PacketNumber; 188 PacketCounter = (int)req.PacketNumber;
188 } 189 }
189 190
190 public bool SendTexture() 191 public bool SendTexture()
@@ -209,7 +210,7 @@ namespace OpenSim.Region.Environment.Modules
209 im.Header.Reliable = false; 210 im.Header.Reliable = false;
210 im.ImageID.Packets = 1; 211 im.ImageID.Packets = 1;
211 im.ImageID.ID = m_asset.FullID; 212 im.ImageID.ID = m_asset.FullID;
212 im.ImageID.Size = (uint) m_asset.Data.Length; 213 im.ImageID.Size = (uint)m_asset.Data.Length;
213 im.ImageData.Data = m_asset.Data; 214 im.ImageData.Data = m_asset.Data;
214 im.ImageID.Codec = 2; 215 im.ImageID.Codec = 2;
215 req.RequestUser.OutPacket(im, ThrottleOutPacketType.Texture); 216 req.RequestUser.OutPacket(im, ThrottleOutPacketType.Texture);
@@ -219,9 +220,9 @@ namespace OpenSim.Region.Environment.Modules
219 { 220 {
220 ImageDataPacket im = new ImageDataPacket(); 221 ImageDataPacket im = new ImageDataPacket();
221 im.Header.Reliable = false; 222 im.Header.Reliable = false;
222 im.ImageID.Packets = (ushort) (NumPackets); 223 im.ImageID.Packets = (ushort)(NumPackets);
223 im.ImageID.ID = m_asset.FullID; 224 im.ImageID.ID = m_asset.FullID;
224 im.ImageID.Size = (uint) m_asset.Data.Length; 225 im.ImageID.Size = (uint)m_asset.Data.Length;
225 im.ImageData.Data = new byte[600]; 226 im.ImageData.Data = new byte[600];
226 Array.Copy(m_asset.Data, 0, im.ImageData.Data, 0, 600); 227 Array.Copy(m_asset.Data, 0, im.ImageData.Data, 0, 600);
227 im.ImageID.Codec = 2; 228 im.ImageID.Codec = 2;
@@ -233,12 +234,12 @@ namespace OpenSim.Region.Environment.Modules
233 { 234 {
234 ImagePacketPacket im = new ImagePacketPacket(); 235 ImagePacketPacket im = new ImagePacketPacket();
235 im.Header.Reliable = false; 236 im.Header.Reliable = false;
236 im.ImageID.Packet = (ushort) (PacketCounter); 237 im.ImageID.Packet = (ushort)(PacketCounter);
237 im.ImageID.ID = m_asset.FullID; 238 im.ImageID.ID = m_asset.FullID;
238 int size = m_asset.Data.Length - 600 - (1000*(PacketCounter - 1)); 239 int size = m_asset.Data.Length - 600 - (1000 * (PacketCounter - 1));
239 if (size > 1000) size = 1000; 240 if (size > 1000) size = 1000;
240 im.ImageData.Data = new byte[size]; 241 im.ImageData.Data = new byte[size];
241 Array.Copy(m_asset.Data, 600 + (1000*(PacketCounter - 1)), im.ImageData.Data, 0, size); 242 Array.Copy(m_asset.Data, 600 + (1000 * (PacketCounter - 1)), im.ImageData.Data, 0, size);
242 req.RequestUser.OutPacket(im, ThrottleOutPacketType.Texture); 243 req.RequestUser.OutPacket(im, ThrottleOutPacketType.Texture);
243 PacketCounter++; 244 PacketCounter++;
244 } 245 }