aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Cache/AssetCache.cs
diff options
context:
space:
mode:
authorMW2007-08-30 13:47:04 +0000
committerMW2007-08-30 13:47:04 +0000
commite1505be97fbf71ac91e0747b7604c1bc7e54e1ed (patch)
tree85c830dedcba4b9d55c709aa9c0d6ca1ad06411d /OpenSim/Framework/Communications/Cache/AssetCache.cs
parentdefault to sqlite for user storage. You will have to recreate (diff)
downloadopensim-SC_OLD-e1505be97fbf71ac91e0747b7604c1bc7e54e1ed.zip
opensim-SC_OLD-e1505be97fbf71ac91e0747b7604c1bc7e54e1ed.tar.gz
opensim-SC_OLD-e1505be97fbf71ac91e0747b7604c1bc7e54e1ed.tar.bz2
opensim-SC_OLD-e1505be97fbf71ac91e0747b7604c1bc7e54e1ed.tar.xz
Added some place holder classes for various modules.
Some work on the asset cache, can people please test this. including on one of the public systems so we can see if it causes problems with multiple users.
Diffstat (limited to 'OpenSim/Framework/Communications/Cache/AssetCache.cs')
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetCache.cs75
1 files changed, 39 insertions, 36 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs
index 3d31ba6..3f594af 100644
--- a/OpenSim/Framework/Communications/Cache/AssetCache.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs
@@ -212,41 +212,41 @@ namespace OpenSim.Framework.Communications.Caches
212 while (true) 212 while (true)
213 { 213 {
214 TextureSender sender = this.QueueTextures.Dequeue(); 214 TextureSender sender = this.QueueTextures.Dequeue();
215 if (TimesTextureSent.ContainsKey(sender.request.RequestUser.AgentId)) 215 /* if (TimesTextureSent.ContainsKey(sender.request.RequestUser.AgentId))
216 { 216 {
217 if (TimesTextureSent[sender.request.RequestUser.AgentId].ContainsKey(sender.request.ImageInfo.FullID)) 217 if (TimesTextureSent[sender.request.RequestUser.AgentId].ContainsKey(sender.request.ImageInfo.FullID))
218 { 218 {
219 TimesTextureSent[sender.request.RequestUser.AgentId][sender.request.ImageInfo.FullID]++; 219 TimesTextureSent[sender.request.RequestUser.AgentId][sender.request.ImageInfo.FullID]++;
220 } 220 }
221 else 221 else
222 { 222 {
223 TimesTextureSent[sender.request.RequestUser.AgentId].Add(sender.request.ImageInfo.FullID, 1); 223 TimesTextureSent[sender.request.RequestUser.AgentId].Add(sender.request.ImageInfo.FullID, 1);
224 } 224 }
225 } 225 }
226 else 226 else
227 { 227 {
228 Dictionary<LLUUID, int> UsersSent = new Dictionary<LLUUID,int>(); 228 Dictionary<LLUUID, int> UsersSent = new Dictionary<LLUUID,int>();
229 TimesTextureSent.Add(sender.request.RequestUser.AgentId, UsersSent ); 229 TimesTextureSent.Add(sender.request.RequestUser.AgentId, UsersSent );
230 UsersSent.Add(sender.request.ImageInfo.FullID, 1); 230 UsersSent.Add(sender.request.ImageInfo.FullID, 1);
231 231
232 } 232 }
233 if (TimesTextureSent[sender.request.RequestUser.AgentId][sender.request.ImageInfo.FullID] < 1000) 233 if (TimesTextureSent[sender.request.RequestUser.AgentId][sender.request.ImageInfo.FullID] < 1000)
234 {*/
235 bool finished = sender.SendTexture();
236 if (finished)
234 { 237 {
235 bool finished = sender.SendTexture(); 238 this.TextureSent(sender);
236 if (finished)
237 {
238 this.TextureSent(sender);
239 }
240 else
241 {
242 // Console.WriteLine("readding texture");
243 this.QueueTextures.Enqueue(sender);
244 }
245 } 239 }
246 else 240 else
247 { 241 {
248 this.TextureSent(sender); 242 // Console.WriteLine("readding texture");
243 this.QueueTextures.Enqueue(sender);
249 } 244 }
245 /* }
246 else
247 {
248 this.TextureSent(sender);
249 }*/
250 } 250 }
251 } 251 }
252 252
@@ -336,7 +336,7 @@ namespace OpenSim.Framework.Communications.Caches
336 ImageNotInDatabasePacket notFound = new ImageNotInDatabasePacket(); 336 ImageNotInDatabasePacket notFound = new ImageNotInDatabasePacket();
337 notFound.ImageID.ID = assetID; 337 notFound.ImageID.ID = assetID;
338 req.RequestUser.OutPacket(notFound); 338 req.RequestUser.OutPacket(notFound);
339 //Console.WriteLine("sending image not found for " + assetID); 339 //Console.WriteLine("sending image not found for " + assetID);
340 340
341 this.RequestedTextures.Remove(assetID); 341 this.RequestedTextures.Remove(assetID);
342 } 342 }
@@ -532,9 +532,9 @@ namespace OpenSim.Framework.Communications.Caches
532 /// </summary> 532 /// </summary>
533 /// <param name="userInfo"></param> 533 /// <param name="userInfo"></param>
534 /// <param name="imageID"></param> 534 /// <param name="imageID"></param>
535 public void AddTextureRequest(IClientAPI userInfo, LLUUID imageID, uint packetNumber) 535 public void AddTextureRequest(IClientAPI userInfo, LLUUID imageID, uint packetNumber, int discard)
536 { 536 {
537 //Console.WriteLine("texture request for " + imageID.ToStringHyphenated() + " packetnumber= " + packetNumber); 537 //Console.WriteLine("texture request for " + imageID.ToStringHyphenated() + " packetnumber= " + packetNumber);
538 //check to see if texture is in local cache, if not request from asset server 538 //check to see if texture is in local cache, if not request from asset server
539 if (!this.AvatarRecievedTextures.ContainsKey(userInfo.AgentId)) 539 if (!this.AvatarRecievedTextures.ContainsKey(userInfo.AgentId))
540 { 540 {
@@ -554,6 +554,7 @@ namespace OpenSim.Framework.Communications.Caches
554 request.RequestUser = userInfo; 554 request.RequestUser = userInfo;
555 request.RequestAssetID = imageID; 555 request.RequestAssetID = imageID;
556 request.IsTextureRequest = true; 556 request.IsTextureRequest = true;
557 request.DiscardLevel = discard;
557 this.RequestedTextures.Add(imageID, request); 558 this.RequestedTextures.Add(imageID, request);
558 this._assetServer.RequestAsset(imageID, true); 559 this._assetServer.RequestAsset(imageID, true);
559 } 560 }
@@ -567,6 +568,7 @@ namespace OpenSim.Framework.Communications.Caches
567 req.RequestAssetID = imageID; 568 req.RequestAssetID = imageID;
568 req.IsTextureRequest = true; 569 req.IsTextureRequest = true;
569 req.ImageInfo = imag; 570 req.ImageInfo = imag;
571 req.DiscardLevel = discard;
570 572
571 if (imag.Data.LongLength > 600) 573 if (imag.Data.LongLength > 600)
572 { 574 {
@@ -641,6 +643,7 @@ namespace OpenSim.Framework.Communications.Caches
641 public byte[] Params = null; 643 public byte[] Params = null;
642 //public bool AssetInCache; 644 //public bool AssetInCache;
643 //public int TimeRequested; 645 //public int TimeRequested;
646 public int DiscardLevel = -1;
644 647
645 public AssetRequest() 648 public AssetRequest()
646 { 649 {
@@ -700,7 +703,7 @@ namespace OpenSim.Framework.Communications.Caches
700 SendPacket(); 703 SendPacket();
701 counter++; 704 counter++;
702 705
703 if ((request.PacketCounter >= request.NumPackets) | counter > 100 | (request.NumPackets == 1)) 706 if ((request.PacketCounter >= request.NumPackets) | counter > 100 | (request.NumPackets == 1) | (request.DiscardLevel == -1))
704 { 707 {
705 return true; 708 return true;
706 } 709 }
@@ -746,7 +749,7 @@ namespace OpenSim.Framework.Communications.Caches
746 req.PacketCounter++; 749 req.PacketCounter++;
747 //req.ImageInfo.last_used = time; 750 //req.ImageInfo.last_used = time;
748 //System.Console.WriteLine("sent first packet of texture: " + req.ImageInfo.FullID); 751 //System.Console.WriteLine("sent first packet of texture: " + req.ImageInfo.FullID);
749 //Console.WriteLine("sending packet 1 for " + req.ImageInfo.FullID.ToStringHyphenated()); 752 //Console.WriteLine("sending packet 1 for " + req.ImageInfo.FullID.ToStringHyphenated());
750 } 753 }
751 } 754 }
752 else 755 else
@@ -758,11 +761,11 @@ namespace OpenSim.Framework.Communications.Caches
758 im.Header.Reliable = false; 761 im.Header.Reliable = false;
759 im.ImageID.Packet = (ushort)(req.PacketCounter); 762 im.ImageID.Packet = (ushort)(req.PacketCounter);
760 im.ImageID.ID = req.ImageInfo.FullID; 763 im.ImageID.ID = req.ImageInfo.FullID;
761 int size = req.ImageInfo.Data.Length - 600 - (1000 * (req.PacketCounter-1)); 764 int size = req.ImageInfo.Data.Length - 600 - (1000 * (req.PacketCounter - 1));
762 if (size > 1000) size = 1000; 765 if (size > 1000) size = 1000;
763 //Console.WriteLine("length= {0} counter= {1} size= {2}",req.ImageInfo.Data.Length, req.PacketCounter, size); 766 //Console.WriteLine("length= {0} counter= {1} size= {2}",req.ImageInfo.Data.Length, req.PacketCounter, size);
764 im.ImageData.Data = new byte[size]; 767 im.ImageData.Data = new byte[size];
765 Array.Copy(req.ImageInfo.Data, 600 + (1000 * (req.PacketCounter-1)), im.ImageData.Data, 0, size); 768 Array.Copy(req.ImageInfo.Data, 600 + (1000 * (req.PacketCounter - 1)), im.ImageData.Data, 0, size);
766 req.RequestUser.OutPacket(im); 769 req.RequestUser.OutPacket(im);
767 req.PacketCounter++; 770 req.PacketCounter++;
768 //req.ImageInfo.last_used = time; 771 //req.ImageInfo.last_used = time;