aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetCache.cs83
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs11
-rw-r--r--OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs5
3 files changed, 48 insertions, 51 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs
index f8b5757..8c451b0 100644
--- a/OpenSim/Framework/Communications/Cache/AssetCache.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs
@@ -49,6 +49,26 @@ namespace OpenSim.Framework.Communications.Cache
49 /// AssetNotFound(), which means they do share the same asset and texture caches. 49 /// AssetNotFound(), which means they do share the same asset and texture caches.
50 public class AssetCache : IAssetCache 50 public class AssetCache : IAssetCache
51 { 51 {
52 private static readonly ILog m_log
53 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54
55 protected ICache m_memcache = new SimpleMemoryCache();
56
57 /// <value>
58 /// Assets requests which are waiting for asset server data. This includes texture requests
59 /// </value>
60 private Dictionary<UUID, AssetRequest> RequestedAssets;
61
62 /// <value>
63 /// Asset requests with data which are ready to be sent back to requesters. This includes textures.
64 /// </value>
65 private List<AssetRequest> AssetRequests;
66
67 /// <value>
68 /// Until the asset request is fulfilled, each asset request is associated with a list of requesters
69 /// </value>
70 private Dictionary<UUID, AssetRequestsList> RequestLists;
71
52 #region IPlugin 72 #region IPlugin
53 73
54 /// <summary> 74 /// <summary>
@@ -77,7 +97,7 @@ namespace OpenSim.Framework.Communications.Cache
77 m_log.Debug("[ASSET CACHE]: Asset cache server-specified initialisation"); 97 m_log.Debug("[ASSET CACHE]: Asset cache server-specified initialisation");
78 m_log.InfoFormat("[ASSET CACHE]: Asset cache initialisation [{0}/{1}]", Name, Version); 98 m_log.InfoFormat("[ASSET CACHE]: Asset cache initialisation [{0}/{1}]", Name, Version);
79 99
80 Initialize(); 100 Reset();
81 101
82 m_assetServer = assetServer; 102 m_assetServer = assetServer;
83 m_assetServer.SetReceiver(this); 103 m_assetServer.SetReceiver(this);
@@ -95,42 +115,31 @@ namespace OpenSim.Framework.Communications.Cache
95 Initialise(assetServer); 115 Initialise(assetServer);
96 } 116 }
97 117
98 public AssetCache()
99 {
100 m_log.Debug("[ASSET CACHE]: Asset cache (plugin constructor)");
101 }
102
103 public void Dispose() 118 public void Dispose()
104 { 119 {
105 } 120 }
106 121
107 #endregion 122 #endregion
108
109 protected ICache m_memcache = new SimpleMemoryCache();
110
111 private static readonly ILog m_log
112 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
113
114 /// <value>
115 /// Assets requests which are waiting for asset server data. This includes texture requests
116 /// </value>
117 private Dictionary<UUID, AssetRequest> RequestedAssets;
118
119 /// <value>
120 /// Asset requests with data which are ready to be sent back to requesters. This includes textures.
121 /// </value>
122 private List<AssetRequest> AssetRequests;
123
124 /// <value>
125 /// Until the asset request is fulfilled, each asset request is associated with a list of requesters
126 /// </value>
127 private Dictionary<UUID, AssetRequestsList> RequestLists;
128 123
129 public IAssetServer AssetServer 124 public IAssetServer AssetServer
130 { 125 {
131 get { return m_assetServer; } 126 get { return m_assetServer; }
132 } 127 }
133 private IAssetServer m_assetServer; 128 private IAssetServer m_assetServer;
129
130 public AssetCache()
131 {
132 m_log.Debug("[ASSET CACHE]: Asset cache (plugin constructor)");
133 }
134
135 /// <summary>
136 /// Constructor.
137 /// </summary>
138 /// <param name="assetServer"></param>
139 public AssetCache(IAssetServer assetServer)
140 {
141 Initialise(assetServer);
142 }
134 143
135 public void ShowState() 144 public void ShowState()
136 { 145 {
@@ -148,31 +157,20 @@ namespace OpenSim.Framework.Communications.Cache
148 if (StatsManager.SimExtraStats != null) 157 if (StatsManager.SimExtraStats != null)
149 StatsManager.SimExtraStats.ClearAssetCacheStatistics(); 158 StatsManager.SimExtraStats.ClearAssetCacheStatistics();
150 159
151 Initialize(); 160 Reset();
152 } 161 }
153 162
154 /// <summary> 163 /// <summary>
155 /// Initialize the cache. 164 /// Reset the cache.
156 /// </summary> 165 /// </summary>
157 private void Initialize() 166 private void Reset()
158 { 167 {
159 AssetRequests = new List<AssetRequest>(); 168 AssetRequests = new List<AssetRequest>();
160
161 RequestedAssets = new Dictionary<UUID, AssetRequest>(); 169 RequestedAssets = new Dictionary<UUID, AssetRequest>();
162 RequestLists = new Dictionary<UUID, AssetRequestsList>(); 170 RequestLists = new Dictionary<UUID, AssetRequestsList>();
163 } 171 }
164 172
165 /// <summary> 173 /// <summary>
166 /// Constructor. Initialize will need to be called separately.
167 /// </summary>
168 /// <param name="assetServer"></param>
169 public AssetCache(IAssetServer assetServer)
170 {
171 m_log.Info("[ASSET CACHE]: Asset cache direct constructor");
172 Initialise(assetServer);
173 }
174
175 /// <summary>
176 /// Process the asset queue which holds data which is packeted up and sent 174 /// Process the asset queue which holds data which is packeted up and sent
177 /// directly back to the client. 175 /// directly back to the client.
178 /// </summary> 176 /// </summary>
@@ -550,7 +548,6 @@ namespace OpenSim.Framework.Communications.Cache
550 req2.RequestAssetID = req.RequestAssetID; 548 req2.RequestAssetID = req.RequestAssetID;
551 req2.TransferRequestID = req.TransferRequestID; 549 req2.TransferRequestID = req.TransferRequestID;
552 req.RequestUser.SendAsset(req2); 550 req.RequestUser.SendAsset(req2);
553
554 } 551 }
555 } 552 }
556 553
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index fd3549e..3840240 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -365,7 +365,7 @@ namespace OpenSim
365 catch 365 catch
366 { 366 {
367 } 367 }
368 m_log.Info("[OPENSIMBASE] Default assetserver will be used"); 368 m_log.Info("[OPENSIMBASE]: Default assetserver will be used");
369 break; 369 break;
370 } 370 }
371 371
@@ -428,6 +428,7 @@ namespace OpenSim
428 if (m_configSettings.AssetCache != null && m_configSettings.AssetCache != String.Empty) 428 if (m_configSettings.AssetCache != null && m_configSettings.AssetCache != String.Empty)
429 { 429 {
430 m_log.DebugFormat("[OPENSIMBASE]: Attempting to load asset cache id = {0}", m_configSettings.AssetCache); 430 m_log.DebugFormat("[OPENSIMBASE]: Attempting to load asset cache id = {0}", m_configSettings.AssetCache);
431
431 try 432 try
432 { 433 {
433 PluginInitialiserBase init = new AssetCachePluginInitialiser(m_configSettings, assetServer); 434 PluginInitialiserBase init = new AssetCachePluginInitialiser(m_configSettings, assetServer);
@@ -440,8 +441,8 @@ namespace OpenSim
440 } 441 }
441 catch (Exception e) 442 catch (Exception e)
442 { 443 {
443 m_log.Debug("[OPENSIMBASE]: ResolveAssetCache completed"); 444 m_log.Error("[OPENSIMBASE]: ResolveAssetCache failed");
444 m_log.Debug(e); 445 m_log.Error(e);
445 } 446 }
446 } 447 }
447 448
@@ -453,12 +454,12 @@ namespace OpenSim
453 { 454 {
454 if (LoginEnabled) 455 if (LoginEnabled)
455 { 456 {
456 m_log.Info("[Login]: Login is now enabled "); 457 m_log.Info("[LOGIN]: Login is now enabled.");
457 m_commsManager.GridService.RegionLoginsEnabled = true; 458 m_commsManager.GridService.RegionLoginsEnabled = true;
458 } 459 }
459 else 460 else
460 { 461 {
461 m_log.Info("[Login]: Login is now disabled "); 462 m_log.Info("[LOGIN]: Login is now disabled.");
462 m_commsManager.GridService.RegionLoginsEnabled = false; 463 m_commsManager.GridService.RegionLoginsEnabled = false;
463 } 464 }
464 } 465 }
diff --git a/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs b/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs
index 38a3033..8416fb6 100644
--- a/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs
+++ b/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs
@@ -59,9 +59,8 @@ namespace OpenSim.Tests.Common.Mock
59 m_userDataPlugin = new TestUserDataPlugin(); 59 m_userDataPlugin = new TestUserDataPlugin();
60 m_inventoryDataPlugin = new TestInventoryDataPlugin(); 60 m_inventoryDataPlugin = new TestInventoryDataPlugin();
61 61
62 SQLAssetServer assetService = new SQLAssetServer(new TestAssetDataPlugin()); 62 SQLAssetServer assetService = new SQLAssetServer(new TestAssetDataPlugin());
63 IAssetCache ac = new AssetCache(assetService); 63 m_assetCache = new AssetCache(assetService);
64 m_assetCache = ac;
65 64
66 LocalInventoryService lis = new LocalInventoryService(); 65 LocalInventoryService lis = new LocalInventoryService();
67 lis.AddPlugin(m_inventoryDataPlugin); 66 lis.AddPlugin(m_inventoryDataPlugin);