In WebStatsModule.OnMakeRootAgent(), get region ID directly from SP.Scene.RegionInfo.RegionID instead of manually looking it up from the stored scene list.

0.7.4.1
Justin Clark-Casey (justincc) 2012-07-16 23:09:48 +01:00
parent ed14dac0a3
commit 217f47b0d5
1 changed files with 2 additions and 18 deletions

View File

@ -319,8 +319,6 @@ namespace OpenSim.Region.UserStatistics
private void OnMakeRootAgent(ScenePresence agent) private void OnMakeRootAgent(ScenePresence agent)
{ {
UUID regionUUID = GetRegionUUIDFromHandle(agent.RegionHandle);
lock (m_sessions) lock (m_sessions)
{ {
if (!m_sessions.ContainsKey(agent.UUID)) if (!m_sessions.ContainsKey(agent.UUID))
@ -330,7 +328,7 @@ namespace OpenSim.Region.UserStatistics
UserSessionID uid = new UserSessionID(); UserSessionID uid = new UserSessionID();
uid.name_f = agent.Firstname; uid.name_f = agent.Firstname;
uid.name_l = agent.Lastname; uid.name_l = agent.Lastname;
uid.region_id = regionUUID; uid.region_id = agent.Scene.RegionInfo.RegionID;
uid.session_id = agent.ControllingClient.SessionId; uid.session_id = agent.ControllingClient.SessionId;
uid.session_data = usd; uid.session_data = usd;
@ -339,7 +337,7 @@ namespace OpenSim.Region.UserStatistics
else else
{ {
UserSessionID uid = m_sessions[agent.UUID]; UserSessionID uid = m_sessions[agent.UUID];
uid.region_id = regionUUID; uid.region_id = agent.Scene.RegionInfo.RegionID;
uid.session_id = agent.ControllingClient.SessionId; uid.session_id = agent.ControllingClient.SessionId;
m_sessions[agent.UUID] = uid; m_sessions[agent.UUID] = uid;
} }
@ -395,20 +393,6 @@ namespace OpenSim.Region.UserStatistics
return encoding.GetString(buffer); return encoding.GetString(buffer);
} }
private UUID GetRegionUUIDFromHandle(ulong regionhandle)
{
lock (m_scenes)
{
foreach (Scene scene in m_scenes)
{
if (scene.RegionInfo.RegionHandle == regionhandle)
return scene.RegionInfo.RegionID;
}
}
return UUID.Zero;
}
/// <summary> /// <summary>
/// Callback for a viewerstats cap /// Callback for a viewerstats cap
/// </summary> /// </summary>