mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 17:05:55 +08:00
* Add total logouts (and total logins) to server side user stats
* Passing the stats collector through object chains is not ideal - this will change when more stats come in * This change will need a prebuild
This commit is contained in:
@@ -34,6 +34,7 @@ using libsecondlife;
|
||||
using libsecondlife.StructuredData;
|
||||
using Nwc.XmlRpc;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Statistics;
|
||||
|
||||
namespace OpenSim.Framework.UserManagement
|
||||
{
|
||||
@@ -44,7 +45,18 @@ namespace OpenSim.Framework.UserManagement
|
||||
{
|
||||
public UserConfig _config;
|
||||
private Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>();
|
||||
protected UserStatsReporter _stats;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="statsCollector">Can be null if stats collection is not required.
|
||||
/// </param>
|
||||
public UserManagerBase(UserStatsReporter statsCollector)
|
||||
{
|
||||
_stats = statsCollector;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new user server plugin - user servers will be requested in the order they were loaded.
|
||||
/// </summary>
|
||||
@@ -411,8 +423,21 @@ namespace OpenSim.Framework.UserManagement
|
||||
|
||||
profile.currentAgent = agent;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Process a user logoff from OpenSim.
|
||||
/// </summary>
|
||||
/// <param name="userid"></param>
|
||||
/// <param name="regionid"></param>
|
||||
/// <param name="regionhandle"></param>
|
||||
/// <param name="posx"></param>
|
||||
/// <param name="posy"></param>
|
||||
/// <param name="posz"></param>
|
||||
public void LogOffUser(LLUUID userid, LLUUID regionid, ulong regionhandle, float posx, float posy, float posz)
|
||||
{
|
||||
if (_stats != null)
|
||||
_stats.AddLogout();
|
||||
|
||||
UserProfileData userProfile;
|
||||
UserAgentData userAgent;
|
||||
LLVector3 currentPos = new LLVector3(posx, posy, posz);
|
||||
@@ -450,6 +475,7 @@ namespace OpenSim.Framework.UserManagement
|
||||
MainLog.Instance.Warn("LOGOUT", "Unknown User logged out");
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateAgent(UserProfileData profile, LLSD request)
|
||||
{
|
||||
UserAgentData agent = new UserAgentData();
|
||||
|
||||
@@ -42,7 +42,13 @@ namespace OpenSim.Framework.Statistics
|
||||
public int SuccessfulLoginsToday { get { return successfulLoginsToday; } }
|
||||
|
||||
private int successfulLoginsYesterday;
|
||||
public int SuccessfulLoginsYesterday { get { return successfulLoginsYesterday; } }
|
||||
public int SuccessfulLoginsYesterday { get { return successfulLoginsYesterday; } }
|
||||
|
||||
private int successfulLogins;
|
||||
public int SuccessfulLogins { get { return successfulLogins; } }
|
||||
|
||||
private int logouts;
|
||||
public int Logouts { get { return logouts; } }
|
||||
|
||||
public UserStatsReporter()
|
||||
{
|
||||
@@ -64,8 +70,14 @@ namespace OpenSim.Framework.Statistics
|
||||
/// </summary>
|
||||
public void AddSuccessfulLogin()
|
||||
{
|
||||
successfulLogins++;
|
||||
successfulLoginsToday++;
|
||||
}
|
||||
|
||||
public void AddLogout()
|
||||
{
|
||||
logouts++;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Report back collected statistical information.
|
||||
@@ -74,9 +86,9 @@ namespace OpenSim.Framework.Statistics
|
||||
public string Report()
|
||||
{
|
||||
return string.Format(
|
||||
@"Successful logins today : {0}
|
||||
Successful logins yesterday : {1}",
|
||||
SuccessfulLoginsToday, SuccessfulLoginsYesterday);
|
||||
@"Successful logins total : {0}, today : {1}, yesterday : {2}
|
||||
Logouts total : {3}",
|
||||
SuccessfulLogins, SuccessfulLoginsToday, SuccessfulLoginsYesterday, Logouts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user