diff options
author | Justin Clarke Casey | 2008-09-07 05:07:57 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-09-07 05:07:57 +0000 |
commit | 815278531ab578dc5c4fbfefb71c6b458c201571 (patch) | |
tree | d467b4222462e8d590d9cdf47268a016bfddac83 | |
parent | * refactor: Remove duplication in UserLoginService where most of the emergenc... (diff) | |
download | opensim-SC-815278531ab578dc5c4fbfefb71c6b458c201571.zip opensim-SC-815278531ab578dc5c4fbfefb71c6b458c201571.tar.gz opensim-SC-815278531ab578dc5c4fbfefb71c6b458c201571.tar.bz2 opensim-SC-815278531ab578dc5c4fbfefb71c6b458c201571.tar.xz |
* Improve login failure handling.
* Now it should properly inform the user and stop a login if a region server could not be contacted in order to expect a user (the last commit didn't actually quite work correctly)
5 files changed, 38 insertions, 43 deletions
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs index d8d0fa2..42292f3 100644 --- a/OpenSim/Framework/Communications/LoginService.cs +++ b/OpenSim/Framework/Communications/LoginService.cs | |||
@@ -74,11 +74,13 @@ namespace OpenSim.Framework.Communications | |||
74 | } | 74 | } |
75 | 75 | ||
76 | /// <summary> | 76 | /// <summary> |
77 | /// Customises the login response and fills in missing values. | 77 | /// Customises the login response and fills in missing values. This method also tells the login region to |
78 | /// expect a client connection. | ||
78 | /// </summary> | 79 | /// </summary> |
79 | /// <param name="response">The existing response</param> | 80 | /// <param name="response">The existing response</param> |
80 | /// <param name="theUser">The user profile</param> | 81 | /// <param name="theUser">The user profile</param> |
81 | public abstract void CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest); | 82 | /// <returns>true on success, false if the region was not successfully told to expect a user connection</returns> |
83 | public abstract bool CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest); | ||
82 | 84 | ||
83 | /// <summary> | 85 | /// <summary> |
84 | /// If the user is already logged in, try to notify the region that the user they've got is dead. | 86 | /// If the user is already logged in, try to notify the region that the user they've got is dead. |
@@ -86,8 +88,8 @@ namespace OpenSim.Framework.Communications | |||
86 | /// <param name="theUser"></param> | 88 | /// <param name="theUser"></param> |
87 | public virtual void LogOffUser(UserProfileData theUser, string message) | 89 | public virtual void LogOffUser(UserProfileData theUser, string message) |
88 | { | 90 | { |
89 | |||
90 | } | 91 | } |
92 | |||
91 | /// <summary> | 93 | /// <summary> |
92 | /// Get the initial login inventory skeleton (in other words, the folder structure) for the given user. | 94 | /// Get the initial login inventory skeleton (in other words, the folder structure) for the given user. |
93 | /// </summary> | 95 | /// </summary> |
@@ -284,29 +286,26 @@ namespace OpenSim.Framework.Communications | |||
284 | logResponse.BuddList = ConvertFriendListItem(m_userManager.GetUserFriendList(agentID)); | 286 | logResponse.BuddList = ConvertFriendListItem(m_userManager.GetUserFriendList(agentID)); |
285 | logResponse.StartLocation = startLocationRequest; | 287 | logResponse.StartLocation = startLocationRequest; |
286 | 288 | ||
287 | try | 289 | if (CustomiseResponse(logResponse, userProfile, startLocationRequest)) |
288 | { | 290 | { |
289 | CustomiseResponse(logResponse, userProfile, startLocationRequest); | 291 | userProfile.LastLogin = userProfile.CurrentAgent.LoginTime; |
292 | CommitAgent(ref userProfile); | ||
293 | |||
294 | // If we reach this point, then the login has successfully logged onto the grid | ||
295 | if (StatsManager.UserStats != null) | ||
296 | StatsManager.UserStats.AddSuccessfulLogin(); | ||
297 | |||
298 | m_log.DebugFormat( | ||
299 | "[LOGIN END]: XMLRPC Authentication of user {0} {1} successful. Sending response to client.", | ||
300 | firstname, lastname); | ||
301 | |||
302 | return logResponse.ToXmlRpcResponse(); | ||
290 | } | 303 | } |
291 | catch (Exception e) | 304 | else |
292 | { | 305 | { |
293 | m_log.Info("[LOGIN END]: XMLRPC " + e.ToString()); | 306 | m_log.ErrorFormat("[LOGIN END]: XMLRPC informing user {0} {1} that login failed due to an unavailable region", firstname, lastname); |
294 | return logResponse.CreateDeadRegionResponse(); | 307 | return logResponse.CreateDeadRegionResponse(); |
295 | //return logResponse.ToXmlRpcResponse(); | ||
296 | } | 308 | } |
297 | |||
298 | userProfile.LastLogin = userProfile.CurrentAgent.LoginTime; | ||
299 | CommitAgent(ref userProfile); | ||
300 | |||
301 | // If we reach this point, then the login has successfully logged onto the grid | ||
302 | if (StatsManager.UserStats != null) | ||
303 | StatsManager.UserStats.AddSuccessfulLogin(); | ||
304 | |||
305 | m_log.DebugFormat( | ||
306 | "[LOGIN END]: XMLRPC Authentication of user {0} {1} successful. Sending response to client.", | ||
307 | firstname, lastname); | ||
308 | |||
309 | return logResponse.ToXmlRpcResponse(); | ||
310 | } | 309 | } |
311 | catch (Exception e) | 310 | catch (Exception e) |
312 | { | 311 | { |
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs index 8683daf..bd0e38b 100644 --- a/OpenSim/Grid/UserServer/UserLoginService.cs +++ b/OpenSim/Grid/UserServer/UserLoginService.cs | |||
@@ -97,8 +97,6 @@ namespace OpenSim.Grid.UserServer | |||
97 | ArrayList SendParams = new ArrayList(); | 97 | ArrayList SendParams = new ArrayList(); |
98 | SendParams.Add(SimParams); | 98 | SendParams.Add(SimParams); |
99 | 99 | ||
100 | // Update agent with target sim | ||
101 | |||
102 | m_log.InfoFormat( | 100 | m_log.InfoFormat( |
103 | "[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}", | 101 | "[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}", |
104 | SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI, | 102 | SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI, |
@@ -124,18 +122,13 @@ namespace OpenSim.Grid.UserServer | |||
124 | //base.LogOffUser(theUser); | 122 | //base.LogOffUser(theUser); |
125 | } | 123 | } |
126 | 124 | ||
127 | //public override void LogOffUser(UserProfileData theUser) | ||
128 | //{ | ||
129 | |||
130 | //} | ||
131 | |||
132 | /// <summary> | 125 | /// <summary> |
133 | /// Customises the login response and fills in missing values. | 126 | /// Customises the login response and fills in missing values. |
134 | /// </summary> | 127 | /// </summary> |
135 | /// <param name="response">The existing response</param> | 128 | /// <param name="response">The existing response</param> |
136 | /// <param name="theUser">The user profile</param> | 129 | /// <param name="theUser">The user profile</param> |
137 | /// <param name="startLocationRequest">Destination of the user</param> | 130 | /// <param name="startLocationRequest">Destination of the user</param> |
138 | public override void CustomiseResponse(LoginResponse response, UserProfileData theUser, | 131 | public override bool CustomiseResponse(LoginResponse response, UserProfileData theUser, |
139 | string startLocationRequest) | 132 | string startLocationRequest) |
140 | { | 133 | { |
141 | RegionProfileData SimInfo; | 134 | RegionProfileData SimInfo; |
@@ -250,8 +243,7 @@ namespace OpenSim.Grid.UserServer | |||
250 | ulong defaultHandle = (((ulong) m_config.DefaultX * Constants.RegionSize) << 32) | | 243 | ulong defaultHandle = (((ulong) m_config.DefaultX * Constants.RegionSize) << 32) | |
251 | ((ulong) m_config.DefaultY * Constants.RegionSize); | 244 | ((ulong) m_config.DefaultY * Constants.RegionSize); |
252 | 245 | ||
253 | m_log.Warn( | 246 | m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead"); |
254 | "[LOGIN]: Sending user to default region " + defaultHandle + " instead"); | ||
255 | 247 | ||
256 | SimInfo = RegionProfileData.RequestSimProfileData( | 248 | SimInfo = RegionProfileData.RequestSimProfileData( |
257 | defaultHandle, m_config.GridServerURL, | 249 | defaultHandle, m_config.GridServerURL, |
@@ -267,8 +259,13 @@ namespace OpenSim.Grid.UserServer | |||
267 | theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z); | 259 | theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z); |
268 | 260 | ||
269 | if (!PrepareLoginToRegion(SimInfo, theUser, response)) | 261 | if (!PrepareLoginToRegion(SimInfo, theUser, response)) |
262 | { | ||
270 | response.CreateDeadRegionResponse(); | 263 | response.CreateDeadRegionResponse(); |
264 | return false; | ||
265 | } | ||
271 | } | 266 | } |
267 | |||
268 | return true; | ||
272 | } | 269 | } |
273 | 270 | ||
274 | /// <summary> | 271 | /// <summary> |
@@ -282,10 +279,7 @@ namespace OpenSim.Grid.UserServer | |||
282 | private bool PrepareLoginToRegion(RegionProfileData sim, UserProfileData user, LoginResponse response) | 279 | private bool PrepareLoginToRegion(RegionProfileData sim, UserProfileData user, LoginResponse response) |
283 | { | 280 | { |
284 | try | 281 | try |
285 | { | 282 | { |
286 | // Destination | ||
287 | m_log.Info("[LOGIN]: CUSTOMISERESPONSE: Region X: " + sim.regionLocX + "; Region Y: " + sim.regionLocY); | ||
288 | |||
289 | response.SimAddress = Util.GetHostFromURL(sim.serverURI).ToString(); | 283 | response.SimAddress = Util.GetHostFromURL(sim.serverURI).ToString(); |
290 | response.SimPort = uint.Parse(sim.serverURI.Split(new char[] {'/', ':'})[4]); | 284 | response.SimPort = uint.Parse(sim.serverURI.Split(new char[] {'/', ':'})[4]); |
291 | response.RegionX = sim.regionLocX; | 285 | response.RegionX = sim.regionLocX; |
@@ -296,7 +290,9 @@ namespace OpenSim.Grid.UserServer | |||
296 | response.SeedCapability = sim.httpServerURI + "CAPS/" + capsPath + "0000/"; | 290 | response.SeedCapability = sim.httpServerURI + "CAPS/" + capsPath + "0000/"; |
297 | 291 | ||
298 | // Notify the target of an incoming user | 292 | // Notify the target of an incoming user |
299 | m_log.Info("[LOGIN]: Telling " + sim.regionName + " (" + sim.serverURI + ") to prepare for client connection"); | 293 | m_log.InfoFormat( |
294 | "[LOGIN]: Telling {0} @ {1},{2} ({3}) to prepare for client connection", | ||
295 | sim.regionName, sim.regionLocX, sim.regionLocY, sim.serverURI); | ||
300 | 296 | ||
301 | // Update agent with target sim | 297 | // Update agent with target sim |
302 | user.CurrentAgent.Region = sim.UUID; | 298 | user.CurrentAgent.Region = sim.UUID; |
@@ -317,8 +313,6 @@ namespace OpenSim.Grid.UserServer | |||
317 | SimParams["caps_path"] = capsPath; | 313 | SimParams["caps_path"] = capsPath; |
318 | ArrayList SendParams = new ArrayList(); | 314 | ArrayList SendParams = new ArrayList(); |
319 | SendParams.Add(SimParams); | 315 | SendParams.Add(SimParams); |
320 | |||
321 | m_log.Info("[LOGIN]: Informing region at " + sim.httpServerURI); | ||
322 | 316 | ||
323 | // Send | 317 | // Send |
324 | XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); | 318 | XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); |
@@ -345,7 +339,6 @@ namespace OpenSim.Grid.UserServer | |||
345 | handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation; | 339 | handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation; |
346 | if (handlerUserLoggedInAtLocation != null) | 340 | if (handlerUserLoggedInAtLocation != null) |
347 | { | 341 | { |
348 | m_log.Info("[LOGIN]: Letting listeners know about successful login"); | ||
349 | handlerUserLoggedInAtLocation(user.ID, user.CurrentAgent.SessionID, | 342 | handlerUserLoggedInAtLocation(user.ID, user.CurrentAgent.SessionID, |
350 | user.CurrentAgent.Region, | 343 | user.CurrentAgent.Region, |
351 | user.CurrentAgent.Handle, | 344 | user.CurrentAgent.Handle, |
@@ -357,11 +350,13 @@ namespace OpenSim.Grid.UserServer | |||
357 | } | 350 | } |
358 | else | 351 | else |
359 | { | 352 | { |
353 | m_log.ErrorFormat("[LOGIN]: Region responded that it is not available to receive clients"); | ||
360 | return false; | 354 | return false; |
361 | } | 355 | } |
362 | } | 356 | } |
363 | else | 357 | else |
364 | { | 358 | { |
359 | m_log.ErrorFormat("[LOGIN]: XmlRpc request to region failed with message {0}, code {1} ", GridResp.FaultString, GridResp.FaultCode); | ||
365 | return false; | 360 | return false; |
366 | } | 361 | } |
367 | } | 362 | } |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index b721fa3..356dee8 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -428,8 +428,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
428 | m_clientThread.IsBackground = true; | 428 | m_clientThread.IsBackground = true; |
429 | m_clientThread.Start(); | 429 | m_clientThread.Start(); |
430 | ThreadTracker.Add(m_clientThread); | 430 | ThreadTracker.Add(m_clientThread); |
431 | |||
432 | m_log.DebugFormat("[CLIENT]: Started new UDP session thread for agent {0}, circuit {1}", agentId, circuitCode); | ||
433 | } | 431 | } |
434 | 432 | ||
435 | public void SetDebug(int newDebug) | 433 | public void SetDebug(int newDebug) |
diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs index 518ba09..7b93bfb 100644 --- a/OpenSim/Region/Communications/Local/LocalLoginService.cs +++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs | |||
@@ -122,7 +122,7 @@ namespace OpenSim.Region.Communications.Local | |||
122 | 122 | ||
123 | private Regex reURI = new Regex(@"^uri:(?<region>[^&]+)&(?<x>\d+)&(?<y>\d+)&(?<z>\d+)$"); | 123 | private Regex reURI = new Regex(@"^uri:(?<region>[^&]+)&(?<x>\d+)&(?<y>\d+)&(?<z>\d+)$"); |
124 | 124 | ||
125 | public override void CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest) | 125 | public override bool CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest) |
126 | { | 126 | { |
127 | ulong currentRegion = 0; | 127 | ulong currentRegion = 0; |
128 | 128 | ||
@@ -145,7 +145,6 @@ namespace OpenSim.Region.Communications.Local | |||
145 | { | 145 | { |
146 | currentRegion = theUser.HomeRegion; | 146 | currentRegion = theUser.HomeRegion; |
147 | response.StartLocation = "home"; | 147 | response.StartLocation = "home"; |
148 | |||
149 | } | 148 | } |
150 | else | 149 | else |
151 | { | 150 | { |
@@ -264,7 +263,10 @@ namespace OpenSim.Region.Communications.Local | |||
264 | else | 263 | else |
265 | { | 264 | { |
266 | m_log.Warn("[LOGIN]: Not found region " + currentRegion); | 265 | m_log.Warn("[LOGIN]: Not found region " + currentRegion); |
266 | return false; | ||
267 | } | 267 | } |
268 | |||
269 | return true; | ||
268 | } | 270 | } |
269 | 271 | ||
270 | private LoginResponse.BuddyList ConvertFriendListItem(List<FriendListItem> LFL) | 272 | private LoginResponse.BuddyList ConvertFriendListItem(List<FriendListItem> LFL) |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 4443de9..aaeca4b 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | |||
@@ -89,6 +89,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
89 | { | 89 | { |
90 | serversInfo = servers_info; | 90 | serversInfo = servers_info; |
91 | httpServer = httpServe; | 91 | httpServer = httpServe; |
92 | |||
92 | //Respond to Grid Services requests | 93 | //Respond to Grid Services requests |
93 | httpServer.AddXmlRPCHandler("expect_user", ExpectUser); | 94 | httpServer.AddXmlRPCHandler("expect_user", ExpectUser); |
94 | httpServer.AddXmlRPCHandler("logoff_user", LogOffUser); | 95 | httpServer.AddXmlRPCHandler("logoff_user", LogOffUser); |