aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/PresenceService
diff options
context:
space:
mode:
authorDavid Walter Seikel2016-11-03 21:44:39 +1000
committerDavid Walter Seikel2016-11-03 21:44:39 +1000
commit134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch)
tree216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Services/PresenceService
parentMore changing to production grid. Double oops. (diff)
downloadopensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to 'OpenSim/Services/PresenceService')
-rw-r--r--OpenSim/Services/PresenceService/PresenceService.cs87
-rw-r--r--OpenSim/Services/PresenceService/Properties/AssemblyInfo.cs4
2 files changed, 65 insertions, 26 deletions
diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs
index ed2703e..b5ca4d5 100644
--- a/OpenSim/Services/PresenceService/PresenceService.cs
+++ b/OpenSim/Services/PresenceService/PresenceService.cs
@@ -41,9 +41,7 @@ namespace OpenSim.Services.PresenceService
41{ 41{
42 public class PresenceService : PresenceServiceBase, IPresenceService 42 public class PresenceService : PresenceServiceBase, IPresenceService
43 { 43 {
44 private static readonly ILog m_log = 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 LogManager.GetLogger(
46 MethodBase.GetCurrentMethod().DeclaringType);
47 45
48 protected bool m_allowDuplicatePresences = false; 46 protected bool m_allowDuplicatePresences = false;
49 47
@@ -55,19 +53,15 @@ namespace OpenSim.Services.PresenceService
55 IConfig presenceConfig = config.Configs["PresenceService"]; 53 IConfig presenceConfig = config.Configs["PresenceService"];
56 if (presenceConfig != null) 54 if (presenceConfig != null)
57 { 55 {
58 m_allowDuplicatePresences = 56 m_allowDuplicatePresences = presenceConfig.GetBoolean("AllowDuplicatePresences", m_allowDuplicatePresences);
59 presenceConfig.GetBoolean("AllowDuplicatePresences",
60 m_allowDuplicatePresences);
61 } 57 }
62 } 58 }
63 59
64 public bool LoginAgent(string userID, UUID sessionID, 60 public bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID)
65 UUID secureSessionID)
66 { 61 {
67 //PresenceData[] d = m_Database.Get("UserID", userID); 62 PresenceData prevUser = GetUser(userID);
68 //m_Database.Get("UserID", userID);
69 63
70 if (!m_allowDuplicatePresences) 64 if (!m_allowDuplicatePresences && (prevUser != null))
71 m_Database.Delete("UserID", userID.ToString()); 65 m_Database.Delete("UserID", userID.ToString());
72 66
73 PresenceData data = new PresenceData(); 67 PresenceData data = new PresenceData();
@@ -80,19 +74,41 @@ namespace OpenSim.Services.PresenceService
80 74
81 m_Database.Store(data); 75 m_Database.Store(data);
82 76
83 m_log.DebugFormat("[PRESENCE SERVICE]: LoginAgent {0} with session {1} and ssession {2}", 77 string prevUserStr = "";
84 userID, sessionID, secureSessionID); 78 if (prevUser != null)
79 prevUserStr = string.Format(". This user was already logged-in: session {0}, region {1}", prevUser.SessionID, prevUser.RegionID);
80
81 m_log.DebugFormat("[PRESENCE SERVICE]: LoginAgent: session {0}, user {1}, region {2}, secure session {3}{4}",
82 data.SessionID, data.UserID, data.RegionID, secureSessionID, prevUserStr);
83
85 return true; 84 return true;
86 } 85 }
87 86
88 public bool LogoutAgent(UUID sessionID) 87 public bool LogoutAgent(UUID sessionID)
89 { 88 {
90 m_log.DebugFormat("[PRESENCE SERVICE]: Session {0} logout", sessionID); 89 PresenceInfo presence = GetAgent(sessionID);
90
91 m_log.InfoFormat("[PRESENCE SERVICE]: LogoutAgent: session {0}, user {1}, region {2}",
92 sessionID,
93 (presence == null) ? null : presence.UserID,
94 (presence == null) ? null : presence.RegionID.ToString());
95
91 return m_Database.Delete("SessionID", sessionID.ToString()); 96 return m_Database.Delete("SessionID", sessionID.ToString());
92 } 97 }
93 98
94 public bool LogoutRegionAgents(UUID regionID) 99 public bool LogoutRegionAgents(UUID regionID)
95 { 100 {
101 PresenceData[] prevSessions = GetRegionAgents(regionID);
102
103 if ((prevSessions == null) || (prevSessions.Length == 0))
104 return true;
105
106 m_log.DebugFormat("[PRESENCE SERVICE]: Logout users in region {0}: {1}", regionID,
107 string.Join(", ", Array.ConvertAll(prevSessions, session => session.UserID)));
108
109 // There's a small chance that LogoutRegionAgents() will logout different users than the
110 // list that was logged above, but it's unlikely and not worth dealing with.
111
96 m_Database.LogoutRegionAgents(regionID); 112 m_Database.LogoutRegionAgents(regionID);
97 113
98 return true; 114 return true;
@@ -101,20 +117,26 @@ namespace OpenSim.Services.PresenceService
101 117
102 public bool ReportAgent(UUID sessionID, UUID regionID) 118 public bool ReportAgent(UUID sessionID, UUID regionID)
103 { 119 {
104// m_log.DebugFormat("[PRESENCE SERVICE]: ReportAgent with session {0} in region {1}", sessionID, regionID);
105 try 120 try
106 { 121 {
107 PresenceData pdata = m_Database.Get(sessionID); 122 PresenceData presence = m_Database.Get(sessionID);
108 if (pdata == null) 123
109 return false; 124 bool success;
110 if (pdata.Data == null) 125 if (presence == null)
111 return false; 126 success = false;
127 else
128 success = m_Database.ReportAgent(sessionID, regionID);
112 129
113 return m_Database.ReportAgent(sessionID, regionID); 130 m_log.DebugFormat("[PRESENCE SERVICE]: ReportAgent{0}: session {1}, user {2}, region {3}. Previously: {4}",
131 success ? "" : " failed",
132 sessionID, (presence == null) ? null : presence.UserID, regionID,
133 (presence == null) ? "not logged-in" : "region " + presence.RegionID);
134
135 return success;
114 } 136 }
115 catch (Exception e) 137 catch (Exception e)
116 { 138 {
117 m_log.DebugFormat("[PRESENCE SERVICE]: ReportAgent threw exception {0}", e.StackTrace); 139 m_log.Debug(string.Format("[PRESENCE SERVICE]: ReportAgent for session {0} threw exception ", sessionID), e);
118 return false; 140 return false;
119 } 141 }
120 } 142 }
@@ -139,8 +161,7 @@ namespace OpenSim.Services.PresenceService
139 161
140 foreach (string userIDStr in userIDs) 162 foreach (string userIDStr in userIDs)
141 { 163 {
142 PresenceData[] data = m_Database.Get("UserID", 164 PresenceData[] data = m_Database.Get("UserID", userIDStr);
143 userIDStr);
144 165
145 foreach (PresenceData d in data) 166 foreach (PresenceData d in data)
146 { 167 {
@@ -158,5 +179,23 @@ namespace OpenSim.Services.PresenceService
158 179
159 return info.ToArray(); 180 return info.ToArray();
160 } 181 }
182
183 /// <summary>
184 /// Return the user's Presence. This only really works well if !AllowDuplicatePresences, but that's the default.
185 /// </summary>
186 private PresenceData GetUser(string userID)
187 {
188 PresenceData[] data = m_Database.Get("UserID", userID);
189 if (data.Length > 0)
190 return data[0];
191 else
192 return null;
193 }
194
195 private PresenceData[] GetRegionAgents(UUID regionID)
196 {
197 return m_Database.Get("RegionID", regionID.ToString());
198 }
199
161 } 200 }
162} \ No newline at end of file 201} \ No newline at end of file
diff --git a/OpenSim/Services/PresenceService/Properties/AssemblyInfo.cs b/OpenSim/Services/PresenceService/Properties/AssemblyInfo.cs
index 8c03dd7..4fd21a8 100644
--- a/OpenSim/Services/PresenceService/Properties/AssemblyInfo.cs
+++ b/OpenSim/Services/PresenceService/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.8.3.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33