diff options
author | MW | 2007-06-12 15:30:27 +0000 |
---|---|---|
committer | MW | 2007-06-12 15:30:27 +0000 |
commit | 14ca8a7ae6aae4ebe9bfe4a3eaa04bfe1de31f84 (patch) | |
tree | d840d766f0c08e277b857b727d1366f6bb48a9bd /OpenSim | |
parent | Created OpenSim.Caches project and moved the assetcache to that. (diff) | |
download | opensim-SC_OLD-14ca8a7ae6aae4ebe9bfe4a3eaa04bfe1de31f84.zip opensim-SC_OLD-14ca8a7ae6aae4ebe9bfe4a3eaa04bfe1de31f84.tar.gz opensim-SC_OLD-14ca8a7ae6aae4ebe9bfe4a3eaa04bfe1de31f84.tar.bz2 opensim-SC_OLD-14ca8a7ae6aae4ebe9bfe4a3eaa04bfe1de31f84.tar.xz |
Namespace of asset cache changed from OpenSim.Assets to OpenSim.Caches.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/OpenSim.Caches/AssetCache.cs | 2 | ||||
-rw-r--r-- | OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs | 578 | ||||
-rw-r--r-- | OpenSim/OpenSim.RegionServer/ClientView/ClientView.AgentAssetUpload.cs | 1 | ||||
-rw-r--r-- | OpenSim/OpenSim.RegionServer/ClientView/ClientView.cs | 1 | ||||
-rw-r--r-- | OpenSim/OpenSim.RegionServer/PacketServer.cs | 1 | ||||
-rw-r--r-- | OpenSim/OpenSim.RegionServer/RegionServerBase.cs | 1 | ||||
-rw-r--r-- | OpenSim/OpenSim.RegionServer/UDPServer.cs | 1 | ||||
-rw-r--r-- | OpenSim/OpenSim/OpenSimMain.cs | 1 |
8 files changed, 8 insertions, 578 deletions
diff --git a/OpenSim/OpenSim.Caches/AssetCache.cs b/OpenSim/OpenSim.Caches/AssetCache.cs index fb7fd68..7622b30 100644 --- a/OpenSim/OpenSim.Caches/AssetCache.cs +++ b/OpenSim/OpenSim.Caches/AssetCache.cs | |||
@@ -36,7 +36,7 @@ using OpenSim.Framework.Interfaces; | |||
36 | using OpenSim.Framework.Types; | 36 | using OpenSim.Framework.Types; |
37 | using OpenSim.Framework.Utilities; | 37 | using OpenSim.Framework.Utilities; |
38 | 38 | ||
39 | namespace OpenSim.Assets | 39 | namespace OpenSim.Caches |
40 | { | 40 | { |
41 | /// <summary> | 41 | /// <summary> |
42 | /// Manages local cache of assets and their sending to viewers. | 42 | /// Manages local cache of assets and their sending to viewers. |
diff --git a/OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs b/OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs index 3d17346..7aaa741 100644 --- a/OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs +++ b/OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs | |||
@@ -39,581 +39,5 @@ using OpenSim.Framework.Utilities; | |||
39 | 39 | ||
40 | namespace OpenSim.Assets | 40 | namespace OpenSim.Assets |
41 | { | 41 | { |
42 | /* | 42 | |
43 | /// <summary> | ||
44 | /// Manages local cache of assets and their sending to viewers. | ||
45 | /// </summary> | ||
46 | public class AssetCache : IAssetReceiver | ||
47 | { | ||
48 | public Dictionary<libsecondlife.LLUUID, AssetInfo> Assets; | ||
49 | public Dictionary<libsecondlife.LLUUID, TextureImage> Textures; | ||
50 | |||
51 | public List<AssetRequest> AssetRequests = new List<AssetRequest>(); //assets ready to be sent to viewers | ||
52 | public List<AssetRequest> TextureRequests = new List<AssetRequest>(); //textures ready to be sent | ||
53 | |||
54 | public Dictionary<LLUUID, AssetRequest> RequestedAssets = new Dictionary<LLUUID, AssetRequest>(); //Assets requested from the asset server | ||
55 | public Dictionary<LLUUID, AssetRequest> RequestedTextures = new Dictionary<LLUUID, AssetRequest>(); //Textures requested from the asset server | ||
56 | |||
57 | private IAssetServer _assetServer; | ||
58 | private Thread _assetCacheThread; | ||
59 | private LLUUID[] textureList = new LLUUID[5]; | ||
60 | |||
61 | /// <summary> | ||
62 | /// | ||
63 | /// </summary> | ||
64 | public AssetCache(IAssetServer assetServer) | ||
65 | { | ||
66 | Console.WriteLine("Creating Asset cache"); | ||
67 | _assetServer = assetServer; | ||
68 | _assetServer.SetReceiver(this); | ||
69 | Assets = new Dictionary<libsecondlife.LLUUID, AssetInfo>(); | ||
70 | Textures = new Dictionary<libsecondlife.LLUUID, TextureImage>(); | ||
71 | this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager)); | ||
72 | this._assetCacheThread.IsBackground = true; | ||
73 | this._assetCacheThread.Start(); | ||
74 | |||
75 | } | ||
76 | |||
77 | public AssetCache(string assetServerDLLName, string assetServerURL, string assetServerKey) | ||
78 | { | ||
79 | Console.WriteLine("Creating Asset cache"); | ||
80 | _assetServer = this.LoadAssetDll(assetServerDLLName); | ||
81 | _assetServer.SetServerInfo(assetServerURL, assetServerKey); | ||
82 | _assetServer.SetReceiver(this); | ||
83 | Assets = new Dictionary<libsecondlife.LLUUID, AssetInfo>(); | ||
84 | Textures = new Dictionary<libsecondlife.LLUUID, TextureImage>(); | ||
85 | this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager)); | ||
86 | this._assetCacheThread.IsBackground = true; | ||
87 | this._assetCacheThread.Start(); | ||
88 | |||
89 | } | ||
90 | |||
91 | /// <summary> | ||
92 | /// | ||
93 | /// </summary> | ||
94 | public void RunAssetManager() | ||
95 | { | ||
96 | while (true) | ||
97 | { | ||
98 | try | ||
99 | { | ||
100 | //Console.WriteLine("Asset cache loop"); | ||
101 | this.ProcessAssetQueue(); | ||
102 | this.ProcessTextureQueue(); | ||
103 | Thread.Sleep(500); | ||
104 | } | ||
105 | catch (Exception e) | ||
106 | { | ||
107 | Console.WriteLine(e.Message); | ||
108 | } | ||
109 | } | ||
110 | } | ||
111 | |||
112 | public void LoadDefaultTextureSet() | ||
113 | { | ||
114 | //hack: so we can give each user a set of textures | ||
115 | textureList[0] = new LLUUID("00000000-0000-0000-9999-000000000001"); | ||
116 | textureList[1] = new LLUUID("00000000-0000-0000-9999-000000000002"); | ||
117 | textureList[2] = new LLUUID("00000000-0000-0000-9999-000000000003"); | ||
118 | textureList[3] = new LLUUID("00000000-0000-0000-9999-000000000004"); | ||
119 | textureList[4] = new LLUUID("00000000-0000-0000-9999-000000000005"); | ||
120 | |||
121 | for (int i = 0; i < textureList.Length; i++) | ||
122 | { | ||
123 | this._assetServer.RequestAsset(textureList[i], true); | ||
124 | } | ||
125 | |||
126 | } | ||
127 | |||
128 | public AssetBase[] CreateNewInventorySet(LLUUID agentID) | ||
129 | { | ||
130 | AssetBase[] inventorySet = new AssetBase[this.textureList.Length]; | ||
131 | for (int i = 0; i < textureList.Length; i++) | ||
132 | { | ||
133 | if (this.Textures.ContainsKey(textureList[i])) | ||
134 | { | ||
135 | inventorySet[i] = this.CloneImage(agentID, this.Textures[textureList[i]]); | ||
136 | TextureImage image = new TextureImage(inventorySet[i]); | ||
137 | this.Textures.Add(image.FullID, image); | ||
138 | this._assetServer.UploadNewAsset(image); //save the asset to the asset server | ||
139 | } | ||
140 | } | ||
141 | return inventorySet; | ||
142 | } | ||
143 | |||
144 | public AssetBase GetAsset(LLUUID assetID) | ||
145 | { | ||
146 | AssetBase asset = null; | ||
147 | if(this.Textures.ContainsKey(assetID)) | ||
148 | { | ||
149 | asset = this.Textures[assetID]; | ||
150 | } | ||
151 | else if (this.Assets.ContainsKey(assetID)) | ||
152 | { | ||
153 | asset = this.Assets[assetID]; | ||
154 | } | ||
155 | return asset; | ||
156 | } | ||
157 | |||
158 | public void AddAsset(AssetBase asset) | ||
159 | { | ||
160 | if (asset.Type == 0) | ||
161 | { | ||
162 | if (!this.Textures.ContainsKey(asset.FullID)) | ||
163 | { //texture | ||
164 | TextureImage textur = new TextureImage(asset); | ||
165 | this.Textures.Add(textur.FullID, textur); | ||
166 | this._assetServer.UploadNewAsset(asset); | ||
167 | } | ||
168 | } | ||
169 | else | ||
170 | { | ||
171 | if (!this.Assets.ContainsKey(asset.FullID)) | ||
172 | { | ||
173 | AssetInfo assetInf = new AssetInfo(asset); | ||
174 | this.Assets.Add(assetInf.FullID, assetInf); | ||
175 | this._assetServer.UploadNewAsset(asset); | ||
176 | } | ||
177 | } | ||
178 | } | ||
179 | |||
180 | /// <summary> | ||
181 | /// | ||
182 | /// </summary> | ||
183 | private void ProcessTextureQueue() | ||
184 | { | ||
185 | if (this.TextureRequests.Count == 0) | ||
186 | { | ||
187 | //no requests waiting | ||
188 | return; | ||
189 | } | ||
190 | int num; | ||
191 | |||
192 | if (this.TextureRequests.Count < 5) | ||
193 | { | ||
194 | //lower than 5 so do all of them | ||
195 | num = this.TextureRequests.Count; | ||
196 | } | ||
197 | else | ||
198 | { | ||
199 | num = 5; | ||
200 | } | ||
201 | AssetRequest req; | ||
202 | for (int i = 0; i < num; i++) | ||
203 | { | ||
204 | req = (AssetRequest)this.TextureRequests[i]; | ||
205 | if (req.PacketCounter != req.NumPackets) | ||
206 | { | ||
207 | // if (req.ImageInfo.FullID == new LLUUID("00000000-0000-0000-5005-000000000005")) | ||
208 | if (req.PacketCounter == 0) | ||
209 | { | ||
210 | //first time for this request so send imagedata packet | ||
211 | if (req.NumPackets == 1) | ||
212 | { | ||
213 | //only one packet so send whole file | ||
214 | ImageDataPacket im = new ImageDataPacket(); | ||
215 | im.ImageID.Packets = 1; | ||
216 | im.ImageID.ID = req.ImageInfo.FullID; | ||
217 | im.ImageID.Size = (uint)req.ImageInfo.Data.Length; | ||
218 | im.ImageData.Data = req.ImageInfo.Data; | ||
219 | im.ImageID.Codec = 2; | ||
220 | req.RequestUser.OutPacket(im); | ||
221 | req.PacketCounter++; | ||
222 | //req.ImageInfo.l= time; | ||
223 | //System.Console.WriteLine("sent texture: "+req.image_info.FullID); | ||
224 | } | ||
225 | else | ||
226 | { | ||
227 | //more than one packet so split file up | ||
228 | ImageDataPacket im = new ImageDataPacket(); | ||
229 | im.ImageID.Packets = (ushort)req.NumPackets; | ||
230 | im.ImageID.ID = req.ImageInfo.FullID; | ||
231 | im.ImageID.Size = (uint)req.ImageInfo.Data.Length; | ||
232 | im.ImageData.Data = new byte[600]; | ||
233 | Array.Copy(req.ImageInfo.Data, 0, im.ImageData.Data, 0, 600); | ||
234 | im.ImageID.Codec = 2; | ||
235 | req.RequestUser.OutPacket(im); | ||
236 | req.PacketCounter++; | ||
237 | //req.ImageInfo.last_used = time; | ||
238 | //System.Console.WriteLine("sent first packet of texture: | ||
239 | } | ||
240 | } | ||
241 | else | ||
242 | { | ||
243 | //send imagepacket | ||
244 | //more than one packet so split file up | ||
245 | ImagePacketPacket im = new ImagePacketPacket(); | ||
246 | im.ImageID.Packet = (ushort)req.PacketCounter; | ||
247 | im.ImageID.ID = req.ImageInfo.FullID; | ||
248 | int size = req.ImageInfo.Data.Length - 600 - 1000 * (req.PacketCounter - 1); | ||
249 | if (size > 1000) size = 1000; | ||
250 | im.ImageData.Data = new byte[size]; | ||
251 | Array.Copy(req.ImageInfo.Data, 600 + 1000 * (req.PacketCounter - 1), im.ImageData.Data, 0, size); | ||
252 | req.RequestUser.OutPacket(im); | ||
253 | req.PacketCounter++; | ||
254 | //req.ImageInfo.last_used = time; | ||
255 | //System.Console.WriteLine("sent a packet of texture: "+req.image_info.FullID); | ||
256 | } | ||
257 | } | ||
258 | } | ||
259 | |||
260 | //remove requests that have been completed | ||
261 | int count = 0; | ||
262 | for (int i = 0; i < num; i++) | ||
263 | { | ||
264 | if (this.TextureRequests.Count > count) | ||
265 | { | ||
266 | req = (AssetRequest)this.TextureRequests[count]; | ||
267 | if (req.PacketCounter == req.NumPackets) | ||
268 | { | ||
269 | this.TextureRequests.Remove(req); | ||
270 | } | ||
271 | else | ||
272 | { | ||
273 | count++; | ||
274 | } | ||
275 | } | ||
276 | } | ||
277 | |||
278 | } | ||
279 | public void AssetReceived(AssetBase asset, bool IsTexture) | ||
280 | { | ||
281 | if (asset.FullID != LLUUID.Zero) // if it is set to zero then the asset wasn't found by the server | ||
282 | { | ||
283 | //check if it is a texture or not | ||
284 | //then add to the correct cache list | ||
285 | //then check for waiting requests for this asset/texture (in the Requested lists) | ||
286 | //and move those requests into the Requests list. | ||
287 | if (IsTexture) | ||
288 | { | ||
289 | TextureImage image = new TextureImage(asset); | ||
290 | this.Textures.Add(image.FullID, image); | ||
291 | if (this.RequestedTextures.ContainsKey(image.FullID)) | ||
292 | { | ||
293 | AssetRequest req = this.RequestedTextures[image.FullID]; | ||
294 | req.ImageInfo = image; | ||
295 | if (image.Data.LongLength > 600) | ||
296 | { | ||
297 | //over 600 bytes so split up file | ||
298 | req.NumPackets = 1 + (int)(image.Data.Length - 600 + 999) / 1000; | ||
299 | } | ||
300 | else | ||
301 | { | ||
302 | req.NumPackets = 1; | ||
303 | } | ||
304 | this.RequestedTextures.Remove(image.FullID); | ||
305 | this.TextureRequests.Add(req); | ||
306 | } | ||
307 | } | ||
308 | else | ||
309 | { | ||
310 | AssetInfo assetInf = new AssetInfo(asset); | ||
311 | this.Assets.Add(assetInf.FullID, assetInf); | ||
312 | if (this.RequestedAssets.ContainsKey(assetInf.FullID)) | ||
313 | { | ||
314 | AssetRequest req = this.RequestedAssets[assetInf.FullID]; | ||
315 | req.AssetInf = assetInf; | ||
316 | if (assetInf.Data.LongLength > 600) | ||
317 | { | ||
318 | //over 600 bytes so split up file | ||
319 | req.NumPackets = 1 + (int)(assetInf.Data.Length - 600 + 999) / 1000; | ||
320 | } | ||
321 | else | ||
322 | { | ||
323 | req.NumPackets = 1; | ||
324 | } | ||
325 | this.RequestedAssets.Remove(assetInf.FullID); | ||
326 | this.AssetRequests.Add(req); | ||
327 | } | ||
328 | } | ||
329 | } | ||
330 | } | ||
331 | |||
332 | public void AssetNotFound(AssetBase asset) | ||
333 | { | ||
334 | //the asset server had no knowledge of requested asset | ||
335 | |||
336 | } | ||
337 | |||
338 | #region Assets | ||
339 | /// <summary> | ||
340 | /// | ||
341 | /// </summary> | ||
342 | /// <param name="userInfo"></param> | ||
343 | /// <param name="transferRequest"></param> | ||
344 | public void AddAssetRequest(ClientView userInfo, TransferRequestPacket transferRequest) | ||
345 | { | ||
346 | LLUUID requestID = new LLUUID(transferRequest.TransferInfo.Params, 0); | ||
347 | //check to see if asset is in local cache, if not we need to request it from asset server. | ||
348 | if (!this.Assets.ContainsKey(requestID)) | ||
349 | { | ||
350 | //not found asset | ||
351 | // so request from asset server | ||
352 | if (!this.RequestedAssets.ContainsKey(requestID)) | ||
353 | { | ||
354 | AssetRequest request = new AssetRequest(); | ||
355 | request.RequestUser = userInfo; | ||
356 | request.RequestAssetID = requestID; | ||
357 | request.TransferRequestID = transferRequest.TransferInfo.TransferID; | ||
358 | this.RequestedAssets.Add(requestID, request); | ||
359 | this._assetServer.RequestAsset(requestID, false); | ||
360 | } | ||
361 | return; | ||
362 | } | ||
363 | //it is in our cache | ||
364 | AssetInfo asset = this.Assets[requestID]; | ||
365 | |||
366 | //work out how many packets it should be sent in | ||
367 | // and add to the AssetRequests list | ||
368 | AssetRequest req = new AssetRequest(); | ||
369 | req.RequestUser = userInfo; | ||
370 | req.RequestAssetID = requestID; | ||
371 | req.TransferRequestID = transferRequest.TransferInfo.TransferID; | ||
372 | req.AssetInf = asset; | ||
373 | |||
374 | if (asset.Data.LongLength > 600) | ||
375 | { | ||
376 | //over 600 bytes so split up file | ||
377 | req.NumPackets = 1 + (int)(asset.Data.Length - 600 + 999) / 1000; | ||
378 | } | ||
379 | else | ||
380 | { | ||
381 | req.NumPackets = 1; | ||
382 | } | ||
383 | |||
384 | this.AssetRequests.Add(req); | ||
385 | } | ||
386 | |||
387 | /// <summary> | ||
388 | /// | ||
389 | /// </summary> | ||
390 | private void ProcessAssetQueue() | ||
391 | { | ||
392 | if (this.AssetRequests.Count == 0) | ||
393 | { | ||
394 | //no requests waiting | ||
395 | return; | ||
396 | } | ||
397 | int num; | ||
398 | |||
399 | if (this.AssetRequests.Count < 5) | ||
400 | { | ||
401 | //lower than 5 so do all of them | ||
402 | num = this.AssetRequests.Count; | ||
403 | } | ||
404 | else | ||
405 | { | ||
406 | num = 5; | ||
407 | } | ||
408 | AssetRequest req; | ||
409 | for (int i = 0; i < num; i++) | ||
410 | { | ||
411 | req = (AssetRequest)this.AssetRequests[i]; | ||
412 | |||
413 | TransferInfoPacket Transfer = new TransferInfoPacket(); | ||
414 | Transfer.TransferInfo.ChannelType = 2; | ||
415 | Transfer.TransferInfo.Status = 0; | ||
416 | Transfer.TransferInfo.TargetType = 0; | ||
417 | Transfer.TransferInfo.Params = req.RequestAssetID.GetBytes(); | ||
418 | Transfer.TransferInfo.Size = (int)req.AssetInf.Data.Length; | ||
419 | Transfer.TransferInfo.TransferID = req.TransferRequestID; | ||
420 | req.RequestUser.OutPacket(Transfer); | ||
421 | |||
422 | if (req.NumPackets == 1) | ||
423 | { | ||
424 | TransferPacketPacket TransferPacket = new TransferPacketPacket(); | ||
425 | TransferPacket.TransferData.Packet = 0; | ||
426 | TransferPacket.TransferData.ChannelType = 2; | ||
427 | TransferPacket.TransferData.TransferID = req.TransferRequestID; | ||
428 | TransferPacket.TransferData.Data = req.AssetInf.Data; | ||
429 | TransferPacket.TransferData.Status = 1; | ||
430 | req.RequestUser.OutPacket(TransferPacket); | ||
431 | } | ||
432 | else | ||
433 | { | ||
434 | //more than one packet so split file up , for now it can't be bigger than 2000 bytes | ||
435 | TransferPacketPacket TransferPacket = new TransferPacketPacket(); | ||
436 | TransferPacket.TransferData.Packet = 0; | ||
437 | TransferPacket.TransferData.ChannelType = 2; | ||
438 | TransferPacket.TransferData.TransferID = req.TransferRequestID; | ||
439 | byte[] chunk = new byte[1000]; | ||
440 | Array.Copy(req.AssetInf.Data, chunk, 1000); | ||
441 | TransferPacket.TransferData.Data = chunk; | ||
442 | TransferPacket.TransferData.Status = 0; | ||
443 | req.RequestUser.OutPacket(TransferPacket); | ||
444 | |||
445 | TransferPacket = new TransferPacketPacket(); | ||
446 | TransferPacket.TransferData.Packet = 1; | ||
447 | TransferPacket.TransferData.ChannelType = 2; | ||
448 | TransferPacket.TransferData.TransferID = req.TransferRequestID; | ||
449 | byte[] chunk1 = new byte[(req.AssetInf.Data.Length - 1000)]; | ||
450 | Array.Copy(req.AssetInf.Data, 1000, chunk1, 0, chunk1.Length); | ||
451 | TransferPacket.TransferData.Data = chunk1; | ||
452 | TransferPacket.TransferData.Status = 1; | ||
453 | req.RequestUser.OutPacket(TransferPacket); | ||
454 | } | ||
455 | |||
456 | } | ||
457 | |||
458 | //remove requests that have been completed | ||
459 | for (int i = 0; i < num; i++) | ||
460 | { | ||
461 | this.AssetRequests.RemoveAt(0); | ||
462 | } | ||
463 | |||
464 | } | ||
465 | |||
466 | public AssetInfo CloneAsset(LLUUID newOwner, AssetInfo sourceAsset) | ||
467 | { | ||
468 | AssetInfo newAsset = new AssetInfo(); | ||
469 | newAsset.Data = new byte[sourceAsset.Data.Length]; | ||
470 | Array.Copy(sourceAsset.Data, newAsset.Data, sourceAsset.Data.Length); | ||
471 | newAsset.FullID = LLUUID.Random(); | ||
472 | newAsset.Type = sourceAsset.Type; | ||
473 | newAsset.InvType = sourceAsset.InvType; | ||
474 | return (newAsset); | ||
475 | } | ||
476 | #endregion | ||
477 | |||
478 | #region Textures | ||
479 | /// <summary> | ||
480 | /// | ||
481 | /// </summary> | ||
482 | /// <param name="userInfo"></param> | ||
483 | /// <param name="imageID"></param> | ||
484 | public void AddTextureRequest(ClientView userInfo, LLUUID imageID) | ||
485 | { | ||
486 | //check to see if texture is in local cache, if not request from asset server | ||
487 | if (!this.Textures.ContainsKey(imageID)) | ||
488 | { | ||
489 | if (!this.RequestedTextures.ContainsKey(imageID)) | ||
490 | { | ||
491 | //not is cache so request from asset server | ||
492 | AssetRequest request = new AssetRequest(); | ||
493 | request.RequestUser = userInfo; | ||
494 | request.RequestAssetID = imageID; | ||
495 | request.IsTextureRequest = true; | ||
496 | this.RequestedTextures.Add(imageID, request); | ||
497 | this._assetServer.RequestAsset(imageID, true); | ||
498 | } | ||
499 | return; | ||
500 | } | ||
501 | |||
502 | TextureImage imag = this.Textures[imageID]; | ||
503 | AssetRequest req = new AssetRequest(); | ||
504 | req.RequestUser = userInfo; | ||
505 | req.RequestAssetID = imageID; | ||
506 | req.IsTextureRequest = true; | ||
507 | req.ImageInfo = imag; | ||
508 | |||
509 | if (imag.Data.LongLength > 600) | ||
510 | { | ||
511 | //over 600 bytes so split up file | ||
512 | req.NumPackets = 1 + (int)(imag.Data.Length - 600 + 999) / 1000; | ||
513 | } | ||
514 | else | ||
515 | { | ||
516 | req.NumPackets = 1; | ||
517 | } | ||
518 | this.TextureRequests.Add(req); | ||
519 | } | ||
520 | |||
521 | public TextureImage CloneImage(LLUUID newOwner, TextureImage source) | ||
522 | { | ||
523 | TextureImage newImage = new TextureImage(); | ||
524 | newImage.Data = new byte[source.Data.Length]; | ||
525 | Array.Copy(source.Data, newImage.Data, source.Data.Length); | ||
526 | //newImage.filename = source.filename; | ||
527 | newImage.FullID = LLUUID.Random(); | ||
528 | newImage.Name = source.Name; | ||
529 | return (newImage); | ||
530 | } | ||
531 | #endregion | ||
532 | |||
533 | private IAssetServer LoadAssetDll(string dllName) | ||
534 | { | ||
535 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | ||
536 | IAssetServer server = null; | ||
537 | |||
538 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
539 | { | ||
540 | if (pluginType.IsPublic) | ||
541 | { | ||
542 | if (!pluginType.IsAbstract) | ||
543 | { | ||
544 | Type typeInterface = pluginType.GetInterface("IAssetPlugin", true); | ||
545 | |||
546 | if (typeInterface != null) | ||
547 | { | ||
548 | IAssetPlugin plug = (IAssetPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
549 | server = plug.GetAssetServer(); | ||
550 | break; | ||
551 | } | ||
552 | |||
553 | typeInterface = null; | ||
554 | } | ||
555 | } | ||
556 | } | ||
557 | pluginAssembly = null; | ||
558 | return server; | ||
559 | } | ||
560 | |||
561 | } | ||
562 | |||
563 | public class AssetRequest | ||
564 | { | ||
565 | public ClientView RequestUser; | ||
566 | public LLUUID RequestAssetID; | ||
567 | public AssetInfo AssetInf; | ||
568 | public TextureImage ImageInfo; | ||
569 | public LLUUID TransferRequestID; | ||
570 | public long DataPointer = 0; | ||
571 | public int NumPackets = 0; | ||
572 | public int PacketCounter = 0; | ||
573 | public bool IsTextureRequest; | ||
574 | //public bool AssetInCache; | ||
575 | //public int TimeRequested; | ||
576 | |||
577 | public AssetRequest() | ||
578 | { | ||
579 | |||
580 | } | ||
581 | } | ||
582 | |||
583 | public class AssetInfo : AssetBase | ||
584 | { | ||
585 | public AssetInfo() | ||
586 | { | ||
587 | |||
588 | } | ||
589 | |||
590 | public AssetInfo(AssetBase aBase) | ||
591 | { | ||
592 | Data = aBase.Data; | ||
593 | FullID = aBase.FullID; | ||
594 | Type = aBase.Type; | ||
595 | InvType = aBase.InvType; | ||
596 | Name = aBase.Name; | ||
597 | Description = aBase.Description; | ||
598 | } | ||
599 | } | ||
600 | |||
601 | public class TextureImage : AssetBase | ||
602 | { | ||
603 | public TextureImage() | ||
604 | { | ||
605 | |||
606 | } | ||
607 | |||
608 | public TextureImage(AssetBase aBase) | ||
609 | { | ||
610 | Data = aBase.Data; | ||
611 | FullID = aBase.FullID; | ||
612 | Type = aBase.Type; | ||
613 | InvType = aBase.InvType; | ||
614 | Name = aBase.Name; | ||
615 | Description = aBase.Description; | ||
616 | } | ||
617 | } | ||
618 | */ | ||
619 | } | 43 | } |
diff --git a/OpenSim/OpenSim.RegionServer/ClientView/ClientView.AgentAssetUpload.cs b/OpenSim/OpenSim.RegionServer/ClientView/ClientView.AgentAssetUpload.cs index e57bb42..31749d8 100644 --- a/OpenSim/OpenSim.RegionServer/ClientView/ClientView.AgentAssetUpload.cs +++ b/OpenSim/OpenSim.RegionServer/ClientView/ClientView.AgentAssetUpload.cs | |||
@@ -31,6 +31,7 @@ using System.Text; | |||
31 | using OpenSim.Assets; | 31 | using OpenSim.Assets; |
32 | using OpenSim.Framework.Types; | 32 | using OpenSim.Framework.Types; |
33 | using OpenSim.Framework.Utilities; | 33 | using OpenSim.Framework.Utilities; |
34 | using OpenSim.Caches; | ||
34 | using libsecondlife; | 35 | using libsecondlife; |
35 | using libsecondlife.Packets; | 36 | using libsecondlife.Packets; |
36 | 37 | ||
diff --git a/OpenSim/OpenSim.RegionServer/ClientView/ClientView.cs b/OpenSim/OpenSim.RegionServer/ClientView/ClientView.cs index 0693f70..e9c1f2d 100644 --- a/OpenSim/OpenSim.RegionServer/ClientView/ClientView.cs +++ b/OpenSim/OpenSim.RegionServer/ClientView/ClientView.cs | |||
@@ -42,6 +42,7 @@ using OpenSim.Framework.Types; | |||
42 | using OpenSim.Framework.Inventory; | 42 | using OpenSim.Framework.Inventory; |
43 | using OpenSim.Framework.Utilities; | 43 | using OpenSim.Framework.Utilities; |
44 | using OpenSim.Assets; | 44 | using OpenSim.Assets; |
45 | using OpenSim.Caches; | ||
45 | 46 | ||
46 | namespace OpenSim | 47 | namespace OpenSim |
47 | { | 48 | { |
diff --git a/OpenSim/OpenSim.RegionServer/PacketServer.cs b/OpenSim/OpenSim.RegionServer/PacketServer.cs index f3a7d73..f0bf44f 100644 --- a/OpenSim/OpenSim.RegionServer/PacketServer.cs +++ b/OpenSim/OpenSim.RegionServer/PacketServer.cs | |||
@@ -34,6 +34,7 @@ using OpenSim.Framework; | |||
34 | using System.Net; | 34 | using System.Net; |
35 | using System.Net.Sockets; | 35 | using System.Net.Sockets; |
36 | using OpenSim.Assets; | 36 | using OpenSim.Assets; |
37 | using OpenSim.Caches; | ||
37 | 38 | ||
38 | namespace OpenSim | 39 | namespace OpenSim |
39 | { | 40 | { |
diff --git a/OpenSim/OpenSim.RegionServer/RegionServerBase.cs b/OpenSim/OpenSim.RegionServer/RegionServerBase.cs index e6ecf6e..c059d7c 100644 --- a/OpenSim/OpenSim.RegionServer/RegionServerBase.cs +++ b/OpenSim/OpenSim.RegionServer/RegionServerBase.cs | |||
@@ -43,6 +43,7 @@ using OpenSim.Framework.Types; | |||
43 | using OpenSim.Framework; | 43 | using OpenSim.Framework; |
44 | using OpenSim.UserServer; | 44 | using OpenSim.UserServer; |
45 | using OpenSim.Assets; | 45 | using OpenSim.Assets; |
46 | using OpenSim.Caches; | ||
46 | using OpenSim.Framework.Console; | 47 | using OpenSim.Framework.Console; |
47 | using OpenSim.Physics.Manager; | 48 | using OpenSim.Physics.Manager; |
48 | using Nwc.XmlRpc; | 49 | using Nwc.XmlRpc; |
diff --git a/OpenSim/OpenSim.RegionServer/UDPServer.cs b/OpenSim/OpenSim.RegionServer/UDPServer.cs index 8f2c1f1..090ed7d 100644 --- a/OpenSim/OpenSim.RegionServer/UDPServer.cs +++ b/OpenSim/OpenSim.RegionServer/UDPServer.cs | |||
@@ -42,6 +42,7 @@ using OpenSim.Framework.Interfaces; | |||
42 | using OpenSim.Framework.Types; | 42 | using OpenSim.Framework.Types; |
43 | using OpenSim.UserServer; | 43 | using OpenSim.UserServer; |
44 | using OpenSim.Assets; | 44 | using OpenSim.Assets; |
45 | using OpenSim.Caches; | ||
45 | using OpenSim.Framework.Console; | 46 | using OpenSim.Framework.Console; |
46 | using OpenSim.Framework; | 47 | using OpenSim.Framework; |
47 | using Nwc.XmlRpc; | 48 | using Nwc.XmlRpc; |
diff --git a/OpenSim/OpenSim/OpenSimMain.cs b/OpenSim/OpenSim/OpenSimMain.cs index 5a20456..0d177b9 100644 --- a/OpenSim/OpenSim/OpenSimMain.cs +++ b/OpenSim/OpenSim/OpenSimMain.cs | |||
@@ -45,6 +45,7 @@ using OpenSim.Framework.Types; | |||
45 | using OpenSim.Framework; | 45 | using OpenSim.Framework; |
46 | using OpenSim.UserServer; | 46 | using OpenSim.UserServer; |
47 | using OpenSim.Assets; | 47 | using OpenSim.Assets; |
48 | using OpenSim.Caches; | ||
48 | using OpenSim.Framework.Console; | 49 | using OpenSim.Framework.Console; |
49 | using OpenSim.Physics.Manager; | 50 | using OpenSim.Physics.Manager; |
50 | using Nwc.XmlRpc; | 51 | using Nwc.XmlRpc; |