mantis 8688: put RegionStatsHandler : BaseStreamHandler tempory back, to give time for external modules to update
parent
6d66770228
commit
04b28f206a
|
@ -94,4 +94,51 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return strBuffer;
|
return strBuffer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// legacy do not use. This will removed in future
|
||||||
|
public class RegionStatsHandler : BaseStreamHandler
|
||||||
|
{
|
||||||
|
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
private string osXStatsURI = String.Empty;
|
||||||
|
//private string osSecret = String.Empty;
|
||||||
|
private OpenSim.Framework.RegionInfo regionInfo;
|
||||||
|
public string localZone = TimeZone.CurrentTimeZone.StandardName;
|
||||||
|
public TimeSpan utcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now);
|
||||||
|
|
||||||
|
public RegionStatsHandler(RegionInfo region_info)
|
||||||
|
: base("GET", "/" + Util.SHA1Hash(region_info.regionSecret), "RegionStats", "Region Statistics")
|
||||||
|
{
|
||||||
|
regionInfo = region_info;
|
||||||
|
osXStatsURI = Util.SHA1Hash(regionInfo.osSecret);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override byte[] ProcessRequest(
|
||||||
|
string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||||
|
{
|
||||||
|
return Util.UTF8.GetBytes(Report());
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ContentType
|
||||||
|
{
|
||||||
|
get { return "text/plain"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private string Report()
|
||||||
|
{
|
||||||
|
OSDMap args = new OSDMap(30);
|
||||||
|
//int time = Util.ToUnixTime(DateTime.Now);
|
||||||
|
args["OSStatsURI"] = OSD.FromString("http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "/" + osXStatsURI + "/");
|
||||||
|
args["TimeZoneName"] = OSD.FromString(localZone);
|
||||||
|
args["TimeZoneOffs"] = OSD.FromReal(utcOffset.TotalHours);
|
||||||
|
args["UxTime"] = OSD.FromInteger(Util.ToUnixTime(DateTime.Now));
|
||||||
|
args["Memory"] = OSD.FromReal(Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0));
|
||||||
|
args["Version"] = OSD.FromString(VersionInfo.Version);
|
||||||
|
|
||||||
|
string strBuffer = "";
|
||||||
|
strBuffer = OSDParser.SerializeJsonString(args);
|
||||||
|
|
||||||
|
return strBuffer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue