diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Grid/AssetServer/Main.cs | 10 | ||||
-rw-r--r-- | OpenSim/Grid/AssetServer/RestService.cs | 14 |
2 files changed, 9 insertions, 15 deletions
diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs index c9f7e8e..23b0afa 100644 --- a/OpenSim/Grid/AssetServer/Main.cs +++ b/OpenSim/Grid/AssetServer/Main.cs | |||
@@ -52,9 +52,7 @@ namespace OpenSim.Grid.AssetServer | |||
52 | // Temporarily hardcoded - should be a plugin | 52 | // Temporarily hardcoded - should be a plugin |
53 | protected IAssetLoader assetLoader = new AssetLoaderFileSystem(); | 53 | protected IAssetLoader assetLoader = new AssetLoaderFileSystem(); |
54 | 54 | ||
55 | private IAssetProvider m_assetProvider; | 55 | private IAssetProvider m_assetProvider; |
56 | |||
57 | protected AssetStatsReporter m_stats; | ||
58 | 56 | ||
59 | [STAThread] | 57 | [STAThread] |
60 | public static void Main(string[] args) | 58 | public static void Main(string[] args) |
@@ -101,9 +99,9 @@ namespace OpenSim.Grid.AssetServer | |||
101 | m_console.Verbose("ASSET", "Starting HTTP process"); | 99 | m_console.Verbose("ASSET", "Starting HTTP process"); |
102 | BaseHttpServer httpServer = new BaseHttpServer(m_config.HttpPort); | 100 | BaseHttpServer httpServer = new BaseHttpServer(m_config.HttpPort); |
103 | 101 | ||
104 | m_stats = new AssetStatsReporter(); | 102 | StatsManager.StartCollectingAssetStats(); |
105 | 103 | ||
106 | httpServer.AddStreamHandler(new GetAssetStreamHandler(this, m_assetProvider, m_stats)); | 104 | httpServer.AddStreamHandler(new GetAssetStreamHandler(this, m_assetProvider)); |
107 | httpServer.AddStreamHandler(new PostAssetStreamHandler(this, m_assetProvider)); | 105 | httpServer.AddStreamHandler(new PostAssetStreamHandler(this, m_assetProvider)); |
108 | 106 | ||
109 | httpServer.Start(); | 107 | httpServer.Start(); |
@@ -184,7 +182,7 @@ namespace OpenSim.Grid.AssetServer | |||
184 | break; | 182 | break; |
185 | 183 | ||
186 | case "stats": | 184 | case "stats": |
187 | m_console.Notice("STATS", Environment.NewLine + m_stats.Report()); | 185 | m_console.Notice("STATS", Environment.NewLine + StatsManager.AssetStats.Report()); |
188 | break; | 186 | break; |
189 | 187 | ||
190 | case "shutdown": | 188 | case "shutdown": |
diff --git a/OpenSim/Grid/AssetServer/RestService.cs b/OpenSim/Grid/AssetServer/RestService.cs index 9b288a7..5c497b6 100644 --- a/OpenSim/Grid/AssetServer/RestService.cs +++ b/OpenSim/Grid/AssetServer/RestService.cs | |||
@@ -43,22 +43,18 @@ namespace OpenSim.Grid.AssetServer | |||
43 | { | 43 | { |
44 | private OpenAsset_Main m_assetManager; | 44 | private OpenAsset_Main m_assetManager; |
45 | private IAssetProvider m_assetProvider; | 45 | private IAssetProvider m_assetProvider; |
46 | private AssetStatsReporter m_stats; | ||
47 | 46 | ||
48 | /// <summary> | 47 | /// <summary> |
49 | /// Constructor. | 48 | /// Constructor. |
50 | /// </summary> | 49 | /// </summary> |
51 | /// <param name="assetManager"></param> | 50 | /// <param name="assetManager"></param> |
52 | /// <param name="assetProvider"></param> | 51 | /// <param name="assetProvider"></param> |
53 | /// <param name="stats">Can be null if stats collection isn't required</param> | 52 | public GetAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider) |
54 | public GetAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider, | ||
55 | AssetStatsReporter stats) | ||
56 | : base("GET", "/assets") | 53 | : base("GET", "/assets") |
57 | { | 54 | { |
58 | MainLog.Instance.Verbose("REST", "In Get Request"); | 55 | MainLog.Instance.Verbose("REST", "In Get Request"); |
59 | m_assetManager = assetManager; | 56 | m_assetManager = assetManager; |
60 | m_assetProvider = assetProvider; | 57 | m_assetProvider = assetProvider; |
61 | m_stats = stats; | ||
62 | } | 58 | } |
63 | 59 | ||
64 | public override byte[] Handle(string path, Stream request) | 60 | public override byte[] Handle(string path, Stream request) |
@@ -80,8 +76,8 @@ namespace OpenSim.Grid.AssetServer | |||
80 | return result; | 76 | return result; |
81 | } | 77 | } |
82 | 78 | ||
83 | if (m_stats != null) | 79 | if (StatsManager.AssetStats != null) |
84 | m_stats.AddRequest(); | 80 | StatsManager.AssetStats.AddRequest(); |
85 | 81 | ||
86 | AssetBase asset = m_assetProvider.FetchAsset(assetID); | 82 | AssetBase asset = m_assetProvider.FetchAsset(assetID); |
87 | if (asset != null) | 83 | if (asset != null) |
@@ -107,8 +103,8 @@ namespace OpenSim.Grid.AssetServer | |||
107 | } | 103 | } |
108 | else | 104 | else |
109 | { | 105 | { |
110 | if (m_stats != null) | 106 | if (StatsManager.AssetStats != null) |
111 | m_stats.AddNotFoundRequest(); | 107 | StatsManager.AssetStats.AddNotFoundRequest(); |
112 | 108 | ||
113 | MainLog.Instance.Verbose("REST", "GET:/asset failed to find {0}", assetID); | 109 | MainLog.Instance.Verbose("REST", "GET:/asset failed to find {0}", assetID); |
114 | } | 110 | } |