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

View File

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

View File

@ -71,6 +71,7 @@ namespace OpenSim.Framework
m_internalEndPoint = ConvertFrom.InternalEndPoint;
m_externalHostName = ConvertFrom.ExternalHostName;
m_remotingPort = ConvertFrom.RemotingPort;
m_httpPort = ConvertFrom.HttpPort;
m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports;
RemotingAddress = ConvertFrom.RemotingAddress;
RegionID = LLUUID.Zero;
@ -79,16 +80,27 @@ namespace OpenSim.Framework
public LLUUID RegionID = LLUUID.Zero;
public uint m_remotingPort;
protected uint m_remotingPort;
public uint RemotingPort
{
get { return m_remotingPort; }
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 string m_serverURI;
protected string m_serverURI;
public string ServerURI
{
get
@ -142,7 +154,6 @@ namespace OpenSim.Framework
}
protected string m_externalHostName;
public string ExternalHostName
{
get { return m_externalHostName; }

View File

@ -49,6 +49,7 @@ namespace OpenSim.Framework
m_internalEndPoint = ConvertFrom.InternalEndPoint;
m_externalHostName = ConvertFrom.ExternalHostName;
m_remotingPort = ConvertFrom.RemotingPort;
m_httpPort = ConvertFrom.HttpPort;
m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports;
RemotingAddress = ConvertFrom.RemotingAddress;
m_proxyUrl = ConvertFrom.proxyUrl;
@ -79,17 +80,29 @@ namespace OpenSim.Framework
public Guid RegionID = LLUUID.Zero.UUID;
public uint m_remotingPort;
public uint RemotingPort
{
get { return m_remotingPort; }
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 string RemotingAddress;
public IPEndPoint ExternalEndPoint
{
get

View File

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

View File

@ -349,7 +349,7 @@ namespace OpenSim
m_standaloneAuthenticate);
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);
// provides the web form login

View File

@ -178,6 +178,10 @@ namespace OpenSim.Region.Communications.Local
_login.StartPos = new LLVector3(128, 128, 70);
_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;
if (handlerLoginToRegion != null)
{

View File

@ -228,7 +228,14 @@ namespace OpenSim.Region.Communications.OGS1
string externalIpStr = Util.GetHostFromDNS(simIp).ToString();
SimpleRegionInfo sri = new SimpleRegionInfo(regX, regY, simIp, 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"]);
neighbours.Add(sri);
@ -276,6 +283,11 @@ namespace OpenSim.Region.Communications.OGS1
regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
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.RegionName = (string) responseData["region_name"];
@ -334,6 +346,11 @@ namespace OpenSim.Region.Communications.OGS1
regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
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.RegionName = (string) responseData["region_name"];
@ -386,6 +403,11 @@ namespace OpenSim.Region.Communications.OGS1
regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
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.RegionName = (string) responseData["region_name"];
@ -815,6 +837,8 @@ namespace OpenSim.Region.Communications.OGS1
region = new SearializableRegionInfo(RequestNeighbourInfo(region.RegionHandle));
region.RemotingAddress = region.ExternalHostName;
region.RemotingPort = NetworkServersInfo.RemotingListenerPort;
region.HttpPort = serversInfo.HttpListenerPort;
if (m_localBackend.RegionUp(region, regionhandle))
{
return true;

View File

@ -554,7 +554,8 @@ namespace OpenSim.Region.Environment.Scenes
// TODO Should construct this behind a method
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),
capsPath);

View File

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