aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-10-06 04:06:27 +0100
committerJustin Clark-Casey (justincc)2012-10-06 04:06:27 +0100
commit13c4fd7271783d3e2c51da7b9509d08aeedf3131 (patch)
tree88265b894e7d7fcfe0b30017fbf49d4044f15fe2 /OpenSim/Region
parentMake UserSessionID a class rather than a struct, so that later updates to val... (diff)
downloadopensim-SC_OLD-13c4fd7271783d3e2c51da7b9509d08aeedf3131.zip
opensim-SC_OLD-13c4fd7271783d3e2c51da7b9509d08aeedf3131.tar.gz
opensim-SC_OLD-13c4fd7271783d3e2c51da7b9509d08aeedf3131.tar.bz2
opensim-SC_OLD-13c4fd7271783d3e2c51da7b9509d08aeedf3131.tar.xz
refactor: Rename UserSessioNID -> UserSession in WebStatsModule since this is what it actually represents
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/UserStatistics/WebStatsModule.cs40
1 files changed, 20 insertions, 20 deletions
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs
index b1795db..625eba4 100644
--- a/OpenSim/Region/UserStatistics/WebStatsModule.cs
+++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs
@@ -61,7 +61,7 @@ namespace OpenSim.Region.UserStatistics
61 /// <summary> 61 /// <summary>
62 /// User statistics sessions keyed by agent ID 62 /// User statistics sessions keyed by agent ID
63 /// </summary> 63 /// </summary>
64 private Dictionary<UUID, UserSessionID> m_sessions = new Dictionary<UUID, UserSessionID>(); 64 private Dictionary<UUID, UserSession> m_sessions = new Dictionary<UUID, UserSession>();
65 65
66 private List<Scene> m_scenes = new List<Scene>(); 66 private List<Scene> m_scenes = new List<Scene>();
67 private Dictionary<string, IStatsController> reports = new Dictionary<string, IStatsController>(); 67 private Dictionary<string, IStatsController> reports = new Dictionary<string, IStatsController>();
@@ -325,12 +325,12 @@ namespace OpenSim.Region.UserStatistics
325 325
326 lock (m_sessions) 326 lock (m_sessions)
327 { 327 {
328 UserSessionID uid; 328 UserSession uid;
329 329
330 if (!m_sessions.ContainsKey(agent.UUID)) 330 if (!m_sessions.ContainsKey(agent.UUID))
331 { 331 {
332 UserSessionData usd = UserSessionUtil.newUserSessionData(); 332 UserSessionData usd = UserSessionUtil.newUserSessionData();
333 uid = new UserSessionID(); 333 uid = new UserSession();
334 uid.name_f = agent.Firstname; 334 uid.name_f = agent.Firstname;
335 uid.name_l = agent.Lastname; 335 uid.name_l = agent.Lastname;
336 uid.session_data = usd; 336 uid.session_data = usd;
@@ -415,9 +415,9 @@ namespace OpenSim.Region.UserStatistics
415 return String.Empty; 415 return String.Empty;
416 } 416 }
417 417
418 private UserSessionID ParseViewerStats(string request, UUID agentID) 418 private UserSession ParseViewerStats(string request, UUID agentID)
419 { 419 {
420 UserSessionID uid = new UserSessionID(); 420 UserSession uid = new UserSession();
421 UserSessionData usd; 421 UserSessionData usd;
422 OSD message = OSDParser.DeserializeLLSDXml(request); 422 OSD message = OSDParser.DeserializeLLSDXml(request);
423 OSDMap mmap; 423 OSDMap mmap;
@@ -429,7 +429,7 @@ namespace OpenSim.Region.UserStatistics
429 if (!m_sessions.ContainsKey(agentID)) 429 if (!m_sessions.ContainsKey(agentID))
430 { 430 {
431 m_log.WarnFormat("[WEB STATS MODULE]: no session for stat disclosure for agent {0}", agentID); 431 m_log.WarnFormat("[WEB STATS MODULE]: no session for stat disclosure for agent {0}", agentID);
432 return new UserSessionID(); 432 return new UserSession();
433 } 433 }
434 434
435 uid = m_sessions[agentID]; 435 uid = m_sessions[agentID];
@@ -440,14 +440,14 @@ namespace OpenSim.Region.UserStatistics
440 { 440 {
441 // parse through the beginning to locate the session 441 // parse through the beginning to locate the session
442 if (message.Type != OSDType.Map) 442 if (message.Type != OSDType.Map)
443 return new UserSessionID(); 443 return new UserSession();
444 444
445 mmap = (OSDMap)message; 445 mmap = (OSDMap)message;
446 { 446 {
447 UUID sessionID = mmap["session_id"].AsUUID(); 447 UUID sessionID = mmap["session_id"].AsUUID();
448 448
449 if (sessionID == UUID.Zero) 449 if (sessionID == UUID.Zero)
450 return new UserSessionID(); 450 return new UserSession();
451 451
452 452
453 // search through each session looking for the owner 453 // search through each session looking for the owner
@@ -466,7 +466,7 @@ namespace OpenSim.Region.UserStatistics
466 // can't find a session 466 // can't find a session
467 if (agentID == UUID.Zero) 467 if (agentID == UUID.Zero)
468 { 468 {
469 return new UserSessionID(); 469 return new UserSession();
470 } 470 }
471 } 471 }
472 } 472 }
@@ -475,12 +475,12 @@ namespace OpenSim.Region.UserStatistics
475 usd = uid.session_data; 475 usd = uid.session_data;
476 476
477 if (message.Type != OSDType.Map) 477 if (message.Type != OSDType.Map)
478 return new UserSessionID(); 478 return new UserSession();
479 479
480 mmap = (OSDMap)message; 480 mmap = (OSDMap)message;
481 { 481 {
482 if (mmap["agent"].Type != OSDType.Map) 482 if (mmap["agent"].Type != OSDType.Map)
483 return new UserSessionID(); 483 return new UserSession();
484 OSDMap agent_map = (OSDMap)mmap["agent"]; 484 OSDMap agent_map = (OSDMap)mmap["agent"];
485 usd.agent_id = agentID; 485 usd.agent_id = agentID;
486 usd.name_f = uid.name_f; 486 usd.name_f = uid.name_f;
@@ -500,7 +500,7 @@ namespace OpenSim.Region.UserStatistics
500 (float)agent_map["fps"].AsReal()); 500 (float)agent_map["fps"].AsReal());
501 501
502 if (mmap["downloads"].Type != OSDType.Map) 502 if (mmap["downloads"].Type != OSDType.Map)
503 return new UserSessionID(); 503 return new UserSession();
504 OSDMap downloads_map = (OSDMap)mmap["downloads"]; 504 OSDMap downloads_map = (OSDMap)mmap["downloads"];
505 usd.d_object_kb = (float)downloads_map["object_kbytes"].AsReal(); 505 usd.d_object_kb = (float)downloads_map["object_kbytes"].AsReal();
506 usd.d_texture_kb = (float)downloads_map["texture_kbytes"].AsReal(); 506 usd.d_texture_kb = (float)downloads_map["texture_kbytes"].AsReal();
@@ -511,7 +511,7 @@ namespace OpenSim.Region.UserStatistics
511 usd.session_id = mmap["session_id"].AsUUID(); 511 usd.session_id = mmap["session_id"].AsUUID();
512 512
513 if (mmap["system"].Type != OSDType.Map) 513 if (mmap["system"].Type != OSDType.Map)
514 return new UserSessionID(); 514 return new UserSession();
515 OSDMap system_map = (OSDMap)mmap["system"]; 515 OSDMap system_map = (OSDMap)mmap["system"];
516 516
517 usd.s_cpu = system_map["cpu"].AsString(); 517 usd.s_cpu = system_map["cpu"].AsString();
@@ -520,13 +520,13 @@ namespace OpenSim.Region.UserStatistics
520 usd.s_ram = system_map["ram"].AsInteger(); 520 usd.s_ram = system_map["ram"].AsInteger();
521 521
522 if (mmap["stats"].Type != OSDType.Map) 522 if (mmap["stats"].Type != OSDType.Map)
523 return new UserSessionID(); 523 return new UserSession();
524 524
525 OSDMap stats_map = (OSDMap)mmap["stats"]; 525 OSDMap stats_map = (OSDMap)mmap["stats"];
526 { 526 {
527 527
528 if (stats_map["failures"].Type != OSDType.Map) 528 if (stats_map["failures"].Type != OSDType.Map)
529 return new UserSessionID(); 529 return new UserSession();
530 OSDMap stats_failures = (OSDMap)stats_map["failures"]; 530 OSDMap stats_failures = (OSDMap)stats_map["failures"];
531 usd.f_dropped = stats_failures["dropped"].AsInteger(); 531 usd.f_dropped = stats_failures["dropped"].AsInteger();
532 usd.f_failed_resends = stats_failures["failed_resends"].AsInteger(); 532 usd.f_failed_resends = stats_failures["failed_resends"].AsInteger();
@@ -535,18 +535,18 @@ namespace OpenSim.Region.UserStatistics
535 usd.f_send_packet = stats_failures["send_packet"].AsInteger(); 535 usd.f_send_packet = stats_failures["send_packet"].AsInteger();
536 536
537 if (stats_map["net"].Type != OSDType.Map) 537 if (stats_map["net"].Type != OSDType.Map)
538 return new UserSessionID(); 538 return new UserSession();
539 OSDMap stats_net = (OSDMap)stats_map["net"]; 539 OSDMap stats_net = (OSDMap)stats_map["net"];
540 { 540 {
541 if (stats_net["in"].Type != OSDType.Map) 541 if (stats_net["in"].Type != OSDType.Map)
542 return new UserSessionID(); 542 return new UserSession();
543 543
544 OSDMap net_in = (OSDMap)stats_net["in"]; 544 OSDMap net_in = (OSDMap)stats_net["in"];
545 usd.n_in_kb = (float)net_in["kbytes"].AsReal(); 545 usd.n_in_kb = (float)net_in["kbytes"].AsReal();
546 usd.n_in_pk = net_in["packets"].AsInteger(); 546 usd.n_in_pk = net_in["packets"].AsInteger();
547 547
548 if (stats_net["out"].Type != OSDType.Map) 548 if (stats_net["out"].Type != OSDType.Map)
549 return new UserSessionID(); 549 return new UserSession();
550 OSDMap net_out = (OSDMap)stats_net["out"]; 550 OSDMap net_out = (OSDMap)stats_net["out"];
551 551
552 usd.n_out_kb = (float)net_out["kbytes"].AsReal(); 552 usd.n_out_kb = (float)net_out["kbytes"].AsReal();
@@ -564,7 +564,7 @@ namespace OpenSim.Region.UserStatistics
564 return uid; 564 return uid;
565 } 565 }
566 566
567 private void UpdateUserStats(UserSessionID uid, SqliteConnection db) 567 private void UpdateUserStats(UserSession uid, SqliteConnection db)
568 { 568 {
569// m_log.DebugFormat( 569// m_log.DebugFormat(
570// "[WEB STATS MODULE]: Updating user stats for {0} {1}, session {2}", uid.name_f, uid.name_l, uid.session_id); 570// "[WEB STATS MODULE]: Updating user stats for {0} {1}, session {2}", uid.name_f, uid.name_l, uid.session_id);
@@ -999,7 +999,7 @@ VALUES
999 } 999 }
1000 #region structs 1000 #region structs
1001 1001
1002 public class UserSessionID 1002 public class UserSession
1003 { 1003 {
1004 public UUID session_id; 1004 public UUID session_id;
1005 public UUID region_id; 1005 public UUID region_id;