* Start passing around a region server's http port in RegionInfo.

* This means that caps methods (editing scripts, poss map functions, etc) on non-home regions should now work with servers which are listening for http ports on a non default 
(9000) port.  
* If you are running a region server, this may only work properly once your grid server upgrades to this revision
* PLEASE NOTE: This shouldn't cause inter-region problems if one end of the connection hasn't upgraded to this revision.  However if it does, the instability will persist until 
the grid and region (and possibly all the region's neighbours) have upgraded to this revision.
* This revision also adds extra login related messages, both for success and failure conditions
0.6.0-stable
Justin Clarke Casey 2008-03-23 21:21:39 +00:00
parent 68d016517d
commit da531fa9e1
10 changed files with 107 additions and 33 deletions

View File

@ -73,7 +73,7 @@ namespace OpenSim.Framework.UserManagement
} }
/// <summary> /// <summary>
/// Main user login function /// Called when we receive the client's initial
/// </summary> /// </summary>
/// <param name="request">The XMLRPC request</param> /// <param name="request">The XMLRPC request</param>
/// <returns>The response to send</returns> /// <returns>The response to send</returns>
@ -94,25 +94,32 @@ namespace OpenSim.Framework.UserManagement
string startLocationRequest = "last"; string startLocationRequest = "last";
if (requestData.Contains("start"))
{
startLocationRequest = (string)requestData["start"];
m_log.Info("[LOGIN]: Client Requested Start: " + (string)requestData["start"]);
}
UserProfileData userProfile; UserProfileData userProfile;
LoginResponse logResponse = new LoginResponse(); LoginResponse logResponse = new LoginResponse();
string firstname = String.Empty;
string lastname = String.Empty;
if (GoodXML) if (GoodXML)
{ {
string firstname = (string) requestData["first"]; firstname = (string) requestData["first"];
string lastname = (string) requestData["last"]; lastname = (string) requestData["last"];
m_log.InfoFormat(
"[LOGIN]: Received login request message from user {0} {1}",
firstname, lastname);
if( requestData.Contains("version")) if( requestData.Contains("version"))
{ {
string clientversion = (string)requestData["version"]; string clientversion = (string)requestData["version"];
m_log.Info("[LOGIN]: Client Version " + clientversion + " for " + firstname + " " + lastname); m_log.Info("[LOGIN]: Client version: " + clientversion);
} }
if (requestData.Contains("start"))
{
startLocationRequest = (string)requestData["start"];
m_log.Info("[LOGIN]: Client requested start location: " + (string)requestData["start"]);
}
userProfile = GetTheUser(firstname, lastname); userProfile = GetTheUser(firstname, lastname);
if (userProfile == null) if (userProfile == null)
@ -134,31 +141,35 @@ namespace OpenSim.Framework.UserManagement
{ {
webloginkey = new LLUUID((string)requestData["web_login_key"]); webloginkey = new LLUUID((string)requestData["web_login_key"]);
} }
catch (System.Exception) catch (System.Exception e)
{ {
m_log.InfoFormat(
"[LOGIN]: Bad web_login_key: {0} for user {1} {2}, exception {3}",
requestData["web_login_key"], firstname, lastname, e);
return logResponse.CreateFailedResponse(); return logResponse.CreateFailedResponse();
} }
GoodLogin = AuthenticateUser(userProfile, webloginkey); GoodLogin = AuthenticateUser(userProfile, webloginkey);
} }
else
{
return logResponse.CreateFailedResponse();
}
} }
else else
{ {
m_log.Info(
"[LOGIN]: login_to_simulator login message did not contain all the required data");
return logResponse.CreateGridErrorResponse(); return logResponse.CreateGridErrorResponse();
} }
if (!GoodLogin) if (!GoodLogin)
{ {
m_log.InfoFormat("[LOGIN]: User {0} {1} failed authentication", firstname, lastname);
return logResponse.CreateLoginFailedResponse(); return logResponse.CreateLoginFailedResponse();
} }
else else
{ {
// If we already have a session... // If we already have a session...
if (userProfile.currentAgent != null && userProfile.currentAgent.agentOnline) if (userProfile.currentAgent != null && userProfile.currentAgent.agentOnline)
{ {
//TODO: The following statements can cause trouble: //TODO: The following statements can cause trouble:
@ -169,6 +180,11 @@ namespace OpenSim.Framework.UserManagement
m_userManager.CommitAgent(ref userProfile); m_userManager.CommitAgent(ref userProfile);
// Reject the login // Reject the login
m_log.InfoFormat(
"[LOGIN]: Notifying user {0} {1} that they are already logged in",
firstname, lastname);
return logResponse.CreateAlreadyLoggedInResponse(); return logResponse.CreateAlreadyLoggedInResponse();
} }
// Otherwise... // Otherwise...
@ -234,14 +250,19 @@ namespace OpenSim.Framework.UserManagement
if (StatsManager.UserStats != null) if (StatsManager.UserStats != null)
StatsManager.UserStats.AddSuccessfulLogin(); StatsManager.UserStats.AddSuccessfulLogin();
m_log.InfoFormat(
"[LOGIN]: Authentication of user {0} {1} successful. Sending response to client.",
firstname, lastname);
return logResponse.ToXmlRpcResponse(); return logResponse.ToXmlRpcResponse();
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Info("[LOGIN]: " + e.ToString()); m_log.Info("[LOGIN]: Login failed, exception" + e.ToString());
} }
//}
} }
m_log.Info("[LOGIN]: Login failed. Sending back blank XMLRPC response");
return response; return response;
} }
finally finally

View File

@ -45,7 +45,7 @@ namespace OpenSim.Framework
public string InventoryURL = String.Empty; public string InventoryURL = String.Empty;
public static uint DefaultHttpListenerPort = 9000; public static readonly uint DefaultHttpListenerPort = 9000;
public uint HttpListenerPort = DefaultHttpListenerPort; public uint HttpListenerPort = DefaultHttpListenerPort;
public static uint RemotingListenerPort = 8895; public static uint RemotingListenerPort = 8895;

View File

@ -71,6 +71,7 @@ namespace OpenSim.Framework
m_internalEndPoint = ConvertFrom.InternalEndPoint; m_internalEndPoint = ConvertFrom.InternalEndPoint;
m_externalHostName = ConvertFrom.ExternalHostName; m_externalHostName = ConvertFrom.ExternalHostName;
m_remotingPort = ConvertFrom.RemotingPort; m_remotingPort = ConvertFrom.RemotingPort;
m_httpPort = ConvertFrom.HttpPort;
m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports; m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports;
RemotingAddress = ConvertFrom.RemotingAddress; RemotingAddress = ConvertFrom.RemotingAddress;
RegionID = LLUUID.Zero; RegionID = LLUUID.Zero;
@ -79,16 +80,27 @@ namespace OpenSim.Framework
public LLUUID RegionID = LLUUID.Zero; public LLUUID RegionID = LLUUID.Zero;
public uint m_remotingPort; protected uint m_remotingPort;
public uint RemotingPort public uint RemotingPort
{ {
get { return m_remotingPort; } get { return m_remotingPort; }
set { m_remotingPort = value; } set { m_remotingPort = value; }
} }
/// <value>
/// The port by which http communication occurs with the region (most noticeably, CAPS communication)
/// </value>
protected uint m_httpPort;
public uint HttpPort
{
get { return m_httpPort; }
set { m_httpPort = value; }
}
public bool m_allow_alternate_ports; public bool m_allow_alternate_ports;
public string m_serverURI; protected string m_serverURI;
public string ServerURI public string ServerURI
{ {
get get
@ -142,7 +154,6 @@ namespace OpenSim.Framework
} }
protected string m_externalHostName; protected string m_externalHostName;
public string ExternalHostName public string ExternalHostName
{ {
get { return m_externalHostName; } get { return m_externalHostName; }

View File

@ -49,6 +49,7 @@ namespace OpenSim.Framework
m_internalEndPoint = ConvertFrom.InternalEndPoint; m_internalEndPoint = ConvertFrom.InternalEndPoint;
m_externalHostName = ConvertFrom.ExternalHostName; m_externalHostName = ConvertFrom.ExternalHostName;
m_remotingPort = ConvertFrom.RemotingPort; m_remotingPort = ConvertFrom.RemotingPort;
m_httpPort = ConvertFrom.HttpPort;
m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports; m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports;
RemotingAddress = ConvertFrom.RemotingAddress; RemotingAddress = ConvertFrom.RemotingAddress;
m_proxyUrl = ConvertFrom.proxyUrl; m_proxyUrl = ConvertFrom.proxyUrl;
@ -79,17 +80,29 @@ namespace OpenSim.Framework
public Guid RegionID = LLUUID.Zero.UUID; public Guid RegionID = LLUUID.Zero.UUID;
public uint m_remotingPort; public uint m_remotingPort;
public uint RemotingPort public uint RemotingPort
{ {
get { return m_remotingPort; } get { return m_remotingPort; }
set { m_remotingPort = value; } set { m_remotingPort = value; }
} }
/// <value>
/// The port by which http communication occurs with the region (most noticeably, CAPS communication)
///
/// FIXME: Defaulting to 9000 temporarily (on the basis that this is the http port most region
/// servers are running) until the revision in which this change is made propogates around grids.
/// </value>
protected uint m_httpPort = 9000;
public uint HttpPort
{
get { return m_httpPort; }
set { m_httpPort = value; }
}
public bool m_allow_alternate_ports; public bool m_allow_alternate_ports;
public string RemotingAddress; public string RemotingAddress;
public IPEndPoint ExternalEndPoint public IPEndPoint ExternalEndPoint
{ {
get get

View File

@ -174,9 +174,9 @@ namespace OpenSim.Grid.UserServer
// Update agent with target sim // Update agent with target sim
m_log.Info("[LOGIN]: Telling " m_log.InfoFormat(
+ SimInfo.regionName + " @ " + SimInfo.httpServerURI + " " + "[LOGIN]: Telling region {0} @ {1},{2} ({3}) to expect user connection",
SimInfo.regionLocX + "," + SimInfo.regionLocY + " to expect user connection"); SimInfo.regionName, response.RegionX, response.RegionY, SimInfo.httpServerURI);
XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);

View File

@ -349,7 +349,7 @@ namespace OpenSim
m_standaloneAuthenticate); m_standaloneAuthenticate);
m_loginService.OnLoginToRegion += backendService.AddNewSession; m_loginService.OnLoginToRegion += backendService.AddNewSession;
// XMLRPC action // set up XMLRPC handler for client's initial login request message
m_httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod); m_httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod);
// provides the web form login // provides the web form login

View File

@ -178,6 +178,10 @@ namespace OpenSim.Region.Communications.Local
_login.StartPos = new LLVector3(128, 128, 70); _login.StartPos = new LLVector3(128, 128, 70);
_login.CapsPath = capsPath; _login.CapsPath = capsPath;
m_log.InfoFormat(
"[LOGIN]: Telling region {0} @ {1},{2} ({3}:{4}) to expect user connection",
reg.RegionName, response.RegionX, response.RegionY, response.SimAddress, response.SimPort);
handlerLoginToRegion = OnLoginToRegion; handlerLoginToRegion = OnLoginToRegion;
if (handlerLoginToRegion != null) if (handlerLoginToRegion != null)
{ {

View File

@ -228,7 +228,14 @@ namespace OpenSim.Region.Communications.OGS1
string externalIpStr = Util.GetHostFromDNS(simIp).ToString(); string externalIpStr = Util.GetHostFromDNS(simIp).ToString();
SimpleRegionInfo sri = new SimpleRegionInfo(regX, regY, simIp, port); SimpleRegionInfo sri = new SimpleRegionInfo(regX, regY, simIp, port);
sri.RemotingPort = Convert.ToUInt32(neighbourData["remoting_port"]); sri.RemotingPort = Convert.ToUInt32(neighbourData["remoting_port"]);
if (neighbourData.ContainsKey("http_port"))
{
sri.HttpPort = Convert.ToUInt32(neighbourData["http_port"]);
}
sri.RegionID = new LLUUID((string) neighbourData["uuid"]); sri.RegionID = new LLUUID((string) neighbourData["uuid"]);
neighbours.Add(sri); neighbours.Add(sri);
@ -275,6 +282,11 @@ namespace OpenSim.Region.Communications.OGS1
regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
regionInfo.RemotingAddress = internalIpStr; regionInfo.RemotingAddress = internalIpStr;
if (responseData.ContainsKey("http_port"))
{
regionInfo.HttpPort = Convert.ToUInt32((string) responseData["http_port"]);
}
regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]); regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]);
regionInfo.RegionName = (string) responseData["region_name"]; regionInfo.RegionName = (string) responseData["region_name"];
@ -333,6 +345,11 @@ namespace OpenSim.Region.Communications.OGS1
regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
regionInfo.RemotingAddress = internalIpStr; regionInfo.RemotingAddress = internalIpStr;
if (responseData.ContainsKey("http_port"))
{
regionInfo.HttpPort = Convert.ToUInt32((string) responseData["http_port"]);
}
regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]); regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]);
regionInfo.RegionName = (string) responseData["region_name"]; regionInfo.RegionName = (string) responseData["region_name"];
@ -385,6 +402,11 @@ namespace OpenSim.Region.Communications.OGS1
regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
regionInfo.RemotingAddress = internalIpStr; regionInfo.RemotingAddress = internalIpStr;
if (responseData.ContainsKey("http_port"))
{
regionInfo.HttpPort = Convert.ToUInt32((string) responseData["http_port"]);
}
regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]); regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]);
regionInfo.RegionName = (string) responseData["region_name"]; regionInfo.RegionName = (string) responseData["region_name"];
@ -813,8 +835,10 @@ namespace OpenSim.Region.Communications.OGS1
// And, surprisingly, the reason is.. it doesn't know // And, surprisingly, the reason is.. it doesn't know
// it's own remoting port! How special. // it's own remoting port! How special.
region = new SearializableRegionInfo(RequestNeighbourInfo(region.RegionHandle)); region = new SearializableRegionInfo(RequestNeighbourInfo(region.RegionHandle));
region.RemotingAddress = region.ExternalHostName; region.RemotingAddress = region.ExternalHostName;
region.RemotingPort = NetworkServersInfo.RemotingListenerPort; region.RemotingPort = NetworkServersInfo.RemotingListenerPort;
region.HttpPort = serversInfo.HttpListenerPort;
if (m_localBackend.RegionUp(region, regionhandle)) if (m_localBackend.RegionUp(region, regionhandle))
{ {
return true; return true;

View File

@ -554,7 +554,8 @@ namespace OpenSim.Region.Environment.Scenes
// TODO Should construct this behind a method // TODO Should construct this behind a method
string capsPath = string capsPath =
"http://" + reg.ExternalHostName + ":" + 9000 + "/CAPS/" + circuitdata.CapsPath + "0000/"; "http://" + reg.ExternalHostName + ":" + reg.HttpPort
+ "/CAPS/" + circuitdata.CapsPath + "0000/";
avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4), avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4),
capsPath); capsPath);

View File

@ -1618,9 +1618,9 @@ namespace OpenSim.Region.Environment.Scenes
{ {
AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo();
// TODO Should construct this behind a method // TODO Should construct this behind a method
string capsPath = string capsPath =
"http://" + neighbourRegion.ExternalHostName + ":" + 9000 "http://" + neighbourRegion.ExternalHostName + ":" + neighbourRegion.HttpPort
+ "/CAPS/" + circuitdata.CapsPath + "0000/"; + "/CAPS/" + circuitdata.CapsPath + "0000/";
m_log.DebugFormat( m_log.DebugFormat(