* 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)0.6.0-stable
parent
260b141306
commit
815278531a
|
@ -74,11 +74,13 @@ namespace OpenSim.Framework.Communications
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Customises the login response and fills in missing values.
|
/// Customises the login response and fills in missing values. This method also tells the login region to
|
||||||
|
/// expect a client connection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="response">The existing response</param>
|
/// <param name="response">The existing response</param>
|
||||||
/// <param name="theUser">The user profile</param>
|
/// <param name="theUser">The user profile</param>
|
||||||
public abstract void CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest);
|
/// <returns>true on success, false if the region was not successfully told to expect a user connection</returns>
|
||||||
|
public abstract bool CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If the user is already logged in, try to notify the region that the user they've got is dead.
|
/// 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
|
||||||
/// <param name="theUser"></param>
|
/// <param name="theUser"></param>
|
||||||
public virtual void LogOffUser(UserProfileData theUser, string message)
|
public virtual void LogOffUser(UserProfileData theUser, string message)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the initial login inventory skeleton (in other words, the folder structure) for the given user.
|
/// Get the initial login inventory skeleton (in other words, the folder structure) for the given user.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -284,29 +286,26 @@ namespace OpenSim.Framework.Communications
|
||||||
logResponse.BuddList = ConvertFriendListItem(m_userManager.GetUserFriendList(agentID));
|
logResponse.BuddList = ConvertFriendListItem(m_userManager.GetUserFriendList(agentID));
|
||||||
logResponse.StartLocation = startLocationRequest;
|
logResponse.StartLocation = startLocationRequest;
|
||||||
|
|
||||||
try
|
if (CustomiseResponse(logResponse, userProfile, startLocationRequest))
|
||||||
{
|
{
|
||||||
CustomiseResponse(logResponse, userProfile, startLocationRequest);
|
userProfile.LastLogin = userProfile.CurrentAgent.LoginTime;
|
||||||
|
CommitAgent(ref userProfile);
|
||||||
|
|
||||||
|
// If we reach this point, then the login has successfully logged onto the grid
|
||||||
|
if (StatsManager.UserStats != null)
|
||||||
|
StatsManager.UserStats.AddSuccessfulLogin();
|
||||||
|
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[LOGIN END]: XMLRPC Authentication of user {0} {1} successful. Sending response to client.",
|
||||||
|
firstname, lastname);
|
||||||
|
|
||||||
|
return logResponse.ToXmlRpcResponse();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
else
|
||||||
{
|
{
|
||||||
m_log.Info("[LOGIN END]: XMLRPC " + e.ToString());
|
m_log.ErrorFormat("[LOGIN END]: XMLRPC informing user {0} {1} that login failed due to an unavailable region", firstname, lastname);
|
||||||
return logResponse.CreateDeadRegionResponse();
|
return logResponse.CreateDeadRegionResponse();
|
||||||
//return logResponse.ToXmlRpcResponse();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
userProfile.LastLogin = userProfile.CurrentAgent.LoginTime;
|
|
||||||
CommitAgent(ref userProfile);
|
|
||||||
|
|
||||||
// If we reach this point, then the login has successfully logged onto the grid
|
|
||||||
if (StatsManager.UserStats != null)
|
|
||||||
StatsManager.UserStats.AddSuccessfulLogin();
|
|
||||||
|
|
||||||
m_log.DebugFormat(
|
|
||||||
"[LOGIN END]: XMLRPC Authentication of user {0} {1} successful. Sending response to client.",
|
|
||||||
firstname, lastname);
|
|
||||||
|
|
||||||
return logResponse.ToXmlRpcResponse();
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -97,8 +97,6 @@ namespace OpenSim.Grid.UserServer
|
||||||
ArrayList SendParams = new ArrayList();
|
ArrayList SendParams = new ArrayList();
|
||||||
SendParams.Add(SimParams);
|
SendParams.Add(SimParams);
|
||||||
|
|
||||||
// Update agent with target sim
|
|
||||||
|
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
"[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}",
|
"[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}",
|
||||||
SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI,
|
SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI,
|
||||||
|
@ -124,18 +122,13 @@ namespace OpenSim.Grid.UserServer
|
||||||
//base.LogOffUser(theUser);
|
//base.LogOffUser(theUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
//public override void LogOffUser(UserProfileData theUser)
|
|
||||||
//{
|
|
||||||
|
|
||||||
//}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Customises the login response and fills in missing values.
|
/// Customises the login response and fills in missing values.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="response">The existing response</param>
|
/// <param name="response">The existing response</param>
|
||||||
/// <param name="theUser">The user profile</param>
|
/// <param name="theUser">The user profile</param>
|
||||||
/// <param name="startLocationRequest">Destination of the user</param>
|
/// <param name="startLocationRequest">Destination of the user</param>
|
||||||
public override void CustomiseResponse(LoginResponse response, UserProfileData theUser,
|
public override bool CustomiseResponse(LoginResponse response, UserProfileData theUser,
|
||||||
string startLocationRequest)
|
string startLocationRequest)
|
||||||
{
|
{
|
||||||
RegionProfileData SimInfo;
|
RegionProfileData SimInfo;
|
||||||
|
@ -250,8 +243,7 @@ namespace OpenSim.Grid.UserServer
|
||||||
ulong defaultHandle = (((ulong) m_config.DefaultX * Constants.RegionSize) << 32) |
|
ulong defaultHandle = (((ulong) m_config.DefaultX * Constants.RegionSize) << 32) |
|
||||||
((ulong) m_config.DefaultY * Constants.RegionSize);
|
((ulong) m_config.DefaultY * Constants.RegionSize);
|
||||||
|
|
||||||
m_log.Warn(
|
m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead");
|
||||||
"[LOGIN]: Sending user to default region " + defaultHandle + " instead");
|
|
||||||
|
|
||||||
SimInfo = RegionProfileData.RequestSimProfileData(
|
SimInfo = RegionProfileData.RequestSimProfileData(
|
||||||
defaultHandle, m_config.GridServerURL,
|
defaultHandle, m_config.GridServerURL,
|
||||||
|
@ -267,8 +259,13 @@ namespace OpenSim.Grid.UserServer
|
||||||
theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
|
theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
|
||||||
|
|
||||||
if (!PrepareLoginToRegion(SimInfo, theUser, response))
|
if (!PrepareLoginToRegion(SimInfo, theUser, response))
|
||||||
|
{
|
||||||
response.CreateDeadRegionResponse();
|
response.CreateDeadRegionResponse();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -282,10 +279,7 @@ namespace OpenSim.Grid.UserServer
|
||||||
private bool PrepareLoginToRegion(RegionProfileData sim, UserProfileData user, LoginResponse response)
|
private bool PrepareLoginToRegion(RegionProfileData sim, UserProfileData user, LoginResponse response)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Destination
|
|
||||||
m_log.Info("[LOGIN]: CUSTOMISERESPONSE: Region X: " + sim.regionLocX + "; Region Y: " + sim.regionLocY);
|
|
||||||
|
|
||||||
response.SimAddress = Util.GetHostFromURL(sim.serverURI).ToString();
|
response.SimAddress = Util.GetHostFromURL(sim.serverURI).ToString();
|
||||||
response.SimPort = uint.Parse(sim.serverURI.Split(new char[] {'/', ':'})[4]);
|
response.SimPort = uint.Parse(sim.serverURI.Split(new char[] {'/', ':'})[4]);
|
||||||
response.RegionX = sim.regionLocX;
|
response.RegionX = sim.regionLocX;
|
||||||
|
@ -296,7 +290,9 @@ namespace OpenSim.Grid.UserServer
|
||||||
response.SeedCapability = sim.httpServerURI + "CAPS/" + capsPath + "0000/";
|
response.SeedCapability = sim.httpServerURI + "CAPS/" + capsPath + "0000/";
|
||||||
|
|
||||||
// Notify the target of an incoming user
|
// Notify the target of an incoming user
|
||||||
m_log.Info("[LOGIN]: Telling " + sim.regionName + " (" + sim.serverURI + ") to prepare for client connection");
|
m_log.InfoFormat(
|
||||||
|
"[LOGIN]: Telling {0} @ {1},{2} ({3}) to prepare for client connection",
|
||||||
|
sim.regionName, sim.regionLocX, sim.regionLocY, sim.serverURI);
|
||||||
|
|
||||||
// Update agent with target sim
|
// Update agent with target sim
|
||||||
user.CurrentAgent.Region = sim.UUID;
|
user.CurrentAgent.Region = sim.UUID;
|
||||||
|
@ -317,8 +313,6 @@ namespace OpenSim.Grid.UserServer
|
||||||
SimParams["caps_path"] = capsPath;
|
SimParams["caps_path"] = capsPath;
|
||||||
ArrayList SendParams = new ArrayList();
|
ArrayList SendParams = new ArrayList();
|
||||||
SendParams.Add(SimParams);
|
SendParams.Add(SimParams);
|
||||||
|
|
||||||
m_log.Info("[LOGIN]: Informing region at " + sim.httpServerURI);
|
|
||||||
|
|
||||||
// Send
|
// Send
|
||||||
XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
|
XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
|
||||||
|
@ -345,7 +339,6 @@ namespace OpenSim.Grid.UserServer
|
||||||
handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation;
|
handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation;
|
||||||
if (handlerUserLoggedInAtLocation != null)
|
if (handlerUserLoggedInAtLocation != null)
|
||||||
{
|
{
|
||||||
m_log.Info("[LOGIN]: Letting listeners know about successful login");
|
|
||||||
handlerUserLoggedInAtLocation(user.ID, user.CurrentAgent.SessionID,
|
handlerUserLoggedInAtLocation(user.ID, user.CurrentAgent.SessionID,
|
||||||
user.CurrentAgent.Region,
|
user.CurrentAgent.Region,
|
||||||
user.CurrentAgent.Handle,
|
user.CurrentAgent.Handle,
|
||||||
|
@ -357,11 +350,13 @@ namespace OpenSim.Grid.UserServer
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
m_log.ErrorFormat("[LOGIN]: Region responded that it is not available to receive clients");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
m_log.ErrorFormat("[LOGIN]: XmlRpc request to region failed with message {0}, code {1} ", GridResp.FaultString, GridResp.FaultCode);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -428,8 +428,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
m_clientThread.IsBackground = true;
|
m_clientThread.IsBackground = true;
|
||||||
m_clientThread.Start();
|
m_clientThread.Start();
|
||||||
ThreadTracker.Add(m_clientThread);
|
ThreadTracker.Add(m_clientThread);
|
||||||
|
|
||||||
m_log.DebugFormat("[CLIENT]: Started new UDP session thread for agent {0}, circuit {1}", agentId, circuitCode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetDebug(int newDebug)
|
public void SetDebug(int newDebug)
|
||||||
|
|
|
@ -122,7 +122,7 @@ namespace OpenSim.Region.Communications.Local
|
||||||
|
|
||||||
private Regex reURI = new Regex(@"^uri:(?<region>[^&]+)&(?<x>\d+)&(?<y>\d+)&(?<z>\d+)$");
|
private Regex reURI = new Regex(@"^uri:(?<region>[^&]+)&(?<x>\d+)&(?<y>\d+)&(?<z>\d+)$");
|
||||||
|
|
||||||
public override void CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest)
|
public override bool CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest)
|
||||||
{
|
{
|
||||||
ulong currentRegion = 0;
|
ulong currentRegion = 0;
|
||||||
|
|
||||||
|
@ -145,7 +145,6 @@ namespace OpenSim.Region.Communications.Local
|
||||||
{
|
{
|
||||||
currentRegion = theUser.HomeRegion;
|
currentRegion = theUser.HomeRegion;
|
||||||
response.StartLocation = "home";
|
response.StartLocation = "home";
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -264,7 +263,10 @@ namespace OpenSim.Region.Communications.Local
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.Warn("[LOGIN]: Not found region " + currentRegion);
|
m_log.Warn("[LOGIN]: Not found region " + currentRegion);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private LoginResponse.BuddyList ConvertFriendListItem(List<FriendListItem> LFL)
|
private LoginResponse.BuddyList ConvertFriendListItem(List<FriendListItem> LFL)
|
||||||
|
|
|
@ -89,6 +89,7 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
{
|
{
|
||||||
serversInfo = servers_info;
|
serversInfo = servers_info;
|
||||||
httpServer = httpServe;
|
httpServer = httpServe;
|
||||||
|
|
||||||
//Respond to Grid Services requests
|
//Respond to Grid Services requests
|
||||||
httpServer.AddXmlRPCHandler("expect_user", ExpectUser);
|
httpServer.AddXmlRPCHandler("expect_user", ExpectUser);
|
||||||
httpServer.AddXmlRPCHandler("logoff_user", LogOffUser);
|
httpServer.AddXmlRPCHandler("logoff_user", LogOffUser);
|
||||||
|
|
Loading…
Reference in New Issue