diff options
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Communications/UserManagerBase.cs | 26 | ||||
-rw-r--r-- | OpenSim/Framework/Statistics/UserStatsReporter.cs | 20 |
2 files changed, 42 insertions, 4 deletions
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index 7e1047f..4967cd9 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs | |||
@@ -34,6 +34,7 @@ using libsecondlife; | |||
34 | using libsecondlife.StructuredData; | 34 | using libsecondlife.StructuredData; |
35 | using Nwc.XmlRpc; | 35 | using Nwc.XmlRpc; |
36 | using OpenSim.Framework.Console; | 36 | using OpenSim.Framework.Console; |
37 | using OpenSim.Framework.Statistics; | ||
37 | 38 | ||
38 | namespace OpenSim.Framework.UserManagement | 39 | namespace OpenSim.Framework.UserManagement |
39 | { | 40 | { |
@@ -44,8 +45,19 @@ namespace OpenSim.Framework.UserManagement | |||
44 | { | 45 | { |
45 | public UserConfig _config; | 46 | public UserConfig _config; |
46 | private Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>(); | 47 | private Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>(); |
48 | protected UserStatsReporter _stats; | ||
47 | 49 | ||
48 | /// <summary> | 50 | /// <summary> |
51 | /// Constructor. | ||
52 | /// </summary> | ||
53 | /// <param name="statsCollector">Can be null if stats collection is not required. | ||
54 | /// </param> | ||
55 | public UserManagerBase(UserStatsReporter statsCollector) | ||
56 | { | ||
57 | _stats = statsCollector; | ||
58 | } | ||
59 | |||
60 | /// <summary> | ||
49 | /// Adds a new user server plugin - user servers will be requested in the order they were loaded. | 61 | /// Adds a new user server plugin - user servers will be requested in the order they were loaded. |
50 | /// </summary> | 62 | /// </summary> |
51 | /// <param name="FileName">The filename to the user server plugin DLL</param> | 63 | /// <param name="FileName">The filename to the user server plugin DLL</param> |
@@ -411,8 +423,21 @@ namespace OpenSim.Framework.UserManagement | |||
411 | 423 | ||
412 | profile.currentAgent = agent; | 424 | profile.currentAgent = agent; |
413 | } | 425 | } |
426 | |||
427 | /// <summary> | ||
428 | /// Process a user logoff from OpenSim. | ||
429 | /// </summary> | ||
430 | /// <param name="userid"></param> | ||
431 | /// <param name="regionid"></param> | ||
432 | /// <param name="regionhandle"></param> | ||
433 | /// <param name="posx"></param> | ||
434 | /// <param name="posy"></param> | ||
435 | /// <param name="posz"></param> | ||
414 | public void LogOffUser(LLUUID userid, LLUUID regionid, ulong regionhandle, float posx, float posy, float posz) | 436 | public void LogOffUser(LLUUID userid, LLUUID regionid, ulong regionhandle, float posx, float posy, float posz) |
415 | { | 437 | { |
438 | if (_stats != null) | ||
439 | _stats.AddLogout(); | ||
440 | |||
416 | UserProfileData userProfile; | 441 | UserProfileData userProfile; |
417 | UserAgentData userAgent; | 442 | UserAgentData userAgent; |
418 | LLVector3 currentPos = new LLVector3(posx, posy, posz); | 443 | LLVector3 currentPos = new LLVector3(posx, posy, posz); |
@@ -450,6 +475,7 @@ namespace OpenSim.Framework.UserManagement | |||
450 | MainLog.Instance.Warn("LOGOUT", "Unknown User logged out"); | 475 | MainLog.Instance.Warn("LOGOUT", "Unknown User logged out"); |
451 | } | 476 | } |
452 | } | 477 | } |
478 | |||
453 | public void CreateAgent(UserProfileData profile, LLSD request) | 479 | public void CreateAgent(UserProfileData profile, LLSD request) |
454 | { | 480 | { |
455 | UserAgentData agent = new UserAgentData(); | 481 | UserAgentData agent = new UserAgentData(); |
diff --git a/OpenSim/Framework/Statistics/UserStatsReporter.cs b/OpenSim/Framework/Statistics/UserStatsReporter.cs index 9b3a13f..bd4f95b 100644 --- a/OpenSim/Framework/Statistics/UserStatsReporter.cs +++ b/OpenSim/Framework/Statistics/UserStatsReporter.cs | |||
@@ -42,7 +42,13 @@ namespace OpenSim.Framework.Statistics | |||
42 | public int SuccessfulLoginsToday { get { return successfulLoginsToday; } } | 42 | public int SuccessfulLoginsToday { get { return successfulLoginsToday; } } |
43 | 43 | ||
44 | private int successfulLoginsYesterday; | 44 | private int successfulLoginsYesterday; |
45 | public int SuccessfulLoginsYesterday { get { return successfulLoginsYesterday; } } | 45 | public int SuccessfulLoginsYesterday { get { return successfulLoginsYesterday; } } |
46 | |||
47 | private int successfulLogins; | ||
48 | public int SuccessfulLogins { get { return successfulLogins; } } | ||
49 | |||
50 | private int logouts; | ||
51 | public int Logouts { get { return logouts; } } | ||
46 | 52 | ||
47 | public UserStatsReporter() | 53 | public UserStatsReporter() |
48 | { | 54 | { |
@@ -64,8 +70,14 @@ namespace OpenSim.Framework.Statistics | |||
64 | /// </summary> | 70 | /// </summary> |
65 | public void AddSuccessfulLogin() | 71 | public void AddSuccessfulLogin() |
66 | { | 72 | { |
73 | successfulLogins++; | ||
67 | successfulLoginsToday++; | 74 | successfulLoginsToday++; |
68 | } | 75 | } |
76 | |||
77 | public void AddLogout() | ||
78 | { | ||
79 | logouts++; | ||
80 | } | ||
69 | 81 | ||
70 | /// <summary> | 82 | /// <summary> |
71 | /// Report back collected statistical information. | 83 | /// Report back collected statistical information. |
@@ -74,9 +86,9 @@ namespace OpenSim.Framework.Statistics | |||
74 | public string Report() | 86 | public string Report() |
75 | { | 87 | { |
76 | return string.Format( | 88 | return string.Format( |
77 | @"Successful logins today : {0} | 89 | @"Successful logins total : {0}, today : {1}, yesterday : {2} |
78 | Successful logins yesterday : {1}", | 90 | Logouts total : {3}", |
79 | SuccessfulLoginsToday, SuccessfulLoginsYesterday); | 91 | SuccessfulLogins, SuccessfulLoginsToday, SuccessfulLoginsYesterday, Logouts); |
80 | } | 92 | } |
81 | } | 93 | } |
82 | } | 94 | } |