diff options
author | Justin Clark-Casey (justincc) | 2013-07-06 00:12:48 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-07-06 00:12:48 +0100 |
commit | 5dbdd5f8b4856357340357394edc2f9e229a0582 (patch) | |
tree | 23d061f124e946327888928fbd2bf618f99a5b18 /OpenSim/Region/Framework | |
parent | Add very basic regression test TestChildAgentSingleRegionCapabilities() which... (diff) | |
download | opensim-SC_OLD-5dbdd5f8b4856357340357394edc2f9e229a0582.zip opensim-SC_OLD-5dbdd5f8b4856357340357394edc2f9e229a0582.tar.gz opensim-SC_OLD-5dbdd5f8b4856357340357394edc2f9e229a0582.tar.bz2 opensim-SC_OLD-5dbdd5f8b4856357340357394edc2f9e229a0582.tar.xz |
refactor: Make stats and sim status simpler by extending BaseStreamHandler like other handlers instead of implementing the IStreamedRequestHandler interface directly
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs index c11174d..726becf 100644 --- a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs +++ b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs | |||
@@ -46,47 +46,33 @@ using OpenSim.Region.Framework.Scenes; | |||
46 | 46 | ||
47 | namespace OpenSim.Region.Framework.Scenes | 47 | namespace OpenSim.Region.Framework.Scenes |
48 | { | 48 | { |
49 | public class RegionStatsHandler : IStreamedRequestHandler | 49 | public class RegionStatsHandler : BaseStreamHandler |
50 | { | 50 | { |
51 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
52 | 52 | ||
53 | private string osRXStatsURI = String.Empty; | ||
54 | private string osXStatsURI = String.Empty; | 53 | private string osXStatsURI = String.Empty; |
55 | //private string osSecret = String.Empty; | 54 | //private string osSecret = String.Empty; |
56 | private OpenSim.Framework.RegionInfo regionInfo; | 55 | private OpenSim.Framework.RegionInfo regionInfo; |
57 | public string localZone = TimeZone.CurrentTimeZone.StandardName; | 56 | public string localZone = TimeZone.CurrentTimeZone.StandardName; |
58 | public TimeSpan utcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now); | 57 | public TimeSpan utcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now); |
59 | 58 | ||
60 | public string Name { get { return "RegionStats"; } } | 59 | public RegionStatsHandler(RegionInfo region_info) |
61 | public string Description { get { return "Region Statistics"; } } | 60 | : base("GET", "/" + Util.SHA1Hash(region_info.regionSecret), "RegionStats", "Region Statistics") |
62 | |||
63 | public RegionStatsHandler(RegionInfo region_info) | ||
64 | { | 61 | { |
65 | regionInfo = region_info; | 62 | regionInfo = region_info; |
66 | osRXStatsURI = Util.SHA1Hash(regionInfo.regionSecret); | ||
67 | osXStatsURI = Util.SHA1Hash(regionInfo.osSecret); | 63 | osXStatsURI = Util.SHA1Hash(regionInfo.osSecret); |
68 | } | 64 | } |
69 | 65 | ||
70 | public byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 66 | public override byte[] Handle( |
67 | string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | ||
71 | { | 68 | { |
72 | return Util.UTF8.GetBytes(Report()); | 69 | return Util.UTF8.GetBytes(Report()); |
73 | } | 70 | } |
74 | 71 | ||
75 | public string ContentType | 72 | public override string ContentType |
76 | { | 73 | { |
77 | get { return "text/plain"; } | 74 | get { return "text/plain"; } |
78 | } | 75 | } |
79 | |||
80 | public string HttpMethod | ||
81 | { | ||
82 | get { return "GET"; } | ||
83 | } | ||
84 | |||
85 | public string Path | ||
86 | { | ||
87 | // This is for the region and is the regionSecret hashed | ||
88 | get { return "/" + osRXStatsURI; } | ||
89 | } | ||
90 | 76 | ||
91 | private string Report() | 77 | private string Report() |
92 | { | 78 | { |