* 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>
|
||||
/// 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>
|
||||
/// <param name="response">The existing response</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>
|
||||
/// 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>
|
||||
public virtual void LogOffUser(UserProfileData theUser, string message)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the initial login inventory skeleton (in other words, the folder structure) for the given user.
|
||||
/// </summary>
|
||||
|
@ -284,17 +286,8 @@ namespace OpenSim.Framework.Communications
|
|||
logResponse.BuddList = ConvertFriendListItem(m_userManager.GetUserFriendList(agentID));
|
||||
logResponse.StartLocation = startLocationRequest;
|
||||
|
||||
try
|
||||
if (CustomiseResponse(logResponse, userProfile, startLocationRequest))
|
||||
{
|
||||
CustomiseResponse(logResponse, userProfile, startLocationRequest);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Info("[LOGIN END]: XMLRPC " + e.ToString());
|
||||
return logResponse.CreateDeadRegionResponse();
|
||||
//return logResponse.ToXmlRpcResponse();
|
||||
}
|
||||
|
||||
userProfile.LastLogin = userProfile.CurrentAgent.LoginTime;
|
||||
CommitAgent(ref userProfile);
|
||||
|
||||
|
@ -308,6 +301,12 @@ namespace OpenSim.Framework.Communications
|
|||
|
||||
return logResponse.ToXmlRpcResponse();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat("[LOGIN END]: XMLRPC informing user {0} {1} that login failed due to an unavailable region", firstname, lastname);
|
||||
return logResponse.CreateDeadRegionResponse();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Info("[LOGIN END]: XMLRPC Login failed, " + e.ToString());
|
||||
|
|
|
@ -97,8 +97,6 @@ namespace OpenSim.Grid.UserServer
|
|||
ArrayList SendParams = new ArrayList();
|
||||
SendParams.Add(SimParams);
|
||||
|
||||
// Update agent with target sim
|
||||
|
||||
m_log.InfoFormat(
|
||||
"[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}",
|
||||
SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI,
|
||||
|
@ -124,18 +122,13 @@ namespace OpenSim.Grid.UserServer
|
|||
//base.LogOffUser(theUser);
|
||||
}
|
||||
|
||||
//public override void LogOffUser(UserProfileData theUser)
|
||||
//{
|
||||
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Customises the login response and fills in missing values.
|
||||
/// </summary>
|
||||
/// <param name="response">The existing response</param>
|
||||
/// <param name="theUser">The user profile</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)
|
||||
{
|
||||
RegionProfileData SimInfo;
|
||||
|
@ -250,8 +243,7 @@ namespace OpenSim.Grid.UserServer
|
|||
ulong defaultHandle = (((ulong) m_config.DefaultX * Constants.RegionSize) << 32) |
|
||||
((ulong) m_config.DefaultY * Constants.RegionSize);
|
||||
|
||||
m_log.Warn(
|
||||
"[LOGIN]: Sending user to default region " + defaultHandle + " instead");
|
||||
m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead");
|
||||
|
||||
SimInfo = RegionProfileData.RequestSimProfileData(
|
||||
defaultHandle, m_config.GridServerURL,
|
||||
|
@ -267,10 +259,15 @@ namespace OpenSim.Grid.UserServer
|
|||
theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
|
||||
|
||||
if (!PrepareLoginToRegion(SimInfo, theUser, response))
|
||||
{
|
||||
response.CreateDeadRegionResponse();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prepare a login to the given region. This involves both telling the region to expect a connection
|
||||
/// and appropriately customising the response to the user.
|
||||
|
@ -283,9 +280,6 @@ namespace OpenSim.Grid.UserServer
|
|||
{
|
||||
try
|
||||
{
|
||||
// Destination
|
||||
m_log.Info("[LOGIN]: CUSTOMISERESPONSE: Region X: " + sim.regionLocX + "; Region Y: " + sim.regionLocY);
|
||||
|
||||
response.SimAddress = Util.GetHostFromURL(sim.serverURI).ToString();
|
||||
response.SimPort = uint.Parse(sim.serverURI.Split(new char[] {'/', ':'})[4]);
|
||||
response.RegionX = sim.regionLocX;
|
||||
|
@ -296,7 +290,9 @@ namespace OpenSim.Grid.UserServer
|
|||
response.SeedCapability = sim.httpServerURI + "CAPS/" + capsPath + "0000/";
|
||||
|
||||
// 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
|
||||
user.CurrentAgent.Region = sim.UUID;
|
||||
|
@ -318,8 +314,6 @@ namespace OpenSim.Grid.UserServer
|
|||
ArrayList SendParams = new ArrayList();
|
||||
SendParams.Add(SimParams);
|
||||
|
||||
m_log.Info("[LOGIN]: Informing region at " + sim.httpServerURI);
|
||||
|
||||
// Send
|
||||
XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
|
||||
XmlRpcResponse GridResp = GridReq.Send(sim.httpServerURI, 6000);
|
||||
|
@ -345,7 +339,6 @@ namespace OpenSim.Grid.UserServer
|
|||
handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation;
|
||||
if (handlerUserLoggedInAtLocation != null)
|
||||
{
|
||||
m_log.Info("[LOGIN]: Letting listeners know about successful login");
|
||||
handlerUserLoggedInAtLocation(user.ID, user.CurrentAgent.SessionID,
|
||||
user.CurrentAgent.Region,
|
||||
user.CurrentAgent.Handle,
|
||||
|
@ -357,11 +350,13 @@ namespace OpenSim.Grid.UserServer
|
|||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat("[LOGIN]: Region responded that it is not available to receive clients");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat("[LOGIN]: XmlRpc request to region failed with message {0}, code {1} ", GridResp.FaultString, GridResp.FaultCode);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -428,8 +428,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
m_clientThread.IsBackground = true;
|
||||
m_clientThread.Start();
|
||||
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)
|
||||
|
|
|
@ -122,7 +122,7 @@ namespace OpenSim.Region.Communications.Local
|
|||
|
||||
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;
|
||||
|
||||
|
@ -145,7 +145,6 @@ namespace OpenSim.Region.Communications.Local
|
|||
{
|
||||
currentRegion = theUser.HomeRegion;
|
||||
response.StartLocation = "home";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -264,7 +263,10 @@ namespace OpenSim.Region.Communications.Local
|
|||
else
|
||||
{
|
||||
m_log.Warn("[LOGIN]: Not found region " + currentRegion);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private LoginResponse.BuddyList ConvertFriendListItem(List<FriendListItem> LFL)
|
||||
|
|
|
@ -89,6 +89,7 @@ namespace OpenSim.Region.Communications.OGS1
|
|||
{
|
||||
serversInfo = servers_info;
|
||||
httpServer = httpServe;
|
||||
|
||||
//Respond to Grid Services requests
|
||||
httpServer.AddXmlRPCHandler("expect_user", ExpectUser);
|
||||
httpServer.AddXmlRPCHandler("logoff_user", LogOffUser);
|
||||
|
|
Loading…
Reference in New Issue