Quick fix for making global references for gatekeepers that are not domain:port work. This needs a serious rewrite, as the assumption domain:port doesn't hold from here on. Just quick-fixing for now.

prebuild-update
Diva Canto 2010-09-02 16:36:05 -07:00
parent 374807d194
commit d96f5fa57d
4 changed files with 38 additions and 28 deletions

View File

@ -86,8 +86,8 @@ namespace OpenSim.Services.Connectors.Hypergrid
paramList.Add(hash); paramList.Add(hash);
XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); XmlRpcRequest request = new XmlRpcRequest("link_region", paramList);
string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"; string uri = "http://" + ((info.ServerURI == string.Empty) ? info.ExternalEndPoint.Address + ":" + info.HttpPort + "/" : info.ServerURI);
//m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri); m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri);
XmlRpcResponse response = null; XmlRpcResponse response = null;
try try
{ {
@ -188,7 +188,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
paramList.Add(hash); paramList.Add(hash);
XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); XmlRpcRequest request = new XmlRpcRequest("get_region", paramList);
string uri = "http://" + gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/"; string uri = "http://" + ((gatekeeper.ServerURI == string.Empty) ? gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/" : gatekeeper.ServerURI);
m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + uri); m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + uri);
XmlRpcResponse response = null; XmlRpcResponse response = null;
try try

View File

@ -51,15 +51,16 @@ namespace OpenSim.Services.Connectors.Hypergrid
MethodBase.GetCurrentMethod().DeclaringType); MethodBase.GetCurrentMethod().DeclaringType);
string m_ServerURL; string m_ServerURL;
Uri m_Uri;
public UserAgentServiceConnector(string url) public UserAgentServiceConnector(string url)
{ {
m_ServerURL = url; m_ServerURL = url;
// Doing this here, because XML-RPC or mono have some strong ideas about
// caching DNS translations.
try try
{ {
m_Uri = new Uri(m_ServerURL); Uri m_Uri = new Uri(m_ServerURL);
IPAddress ip = Util.GetHostFromDNS(m_Uri.Host); IPAddress ip = Util.GetHostFromDNS(m_Uri.Host);
m_ServerURL = "http://" + ip.ToString() + ":" + m_Uri.Port; m_ServerURL = m_ServerURL.Replace(m_Uri.Host, ip.ToString()); ;
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -104,17 +104,23 @@ namespace OpenSim.Services.Connectors.Simulation
return false; return false;
} }
// Eventually, we want to use a caps url instead of the agentID
string uri = string.Empty; string uri = string.Empty;
try
// HACK -- Simian grid make it work!!!
if (destination.ServerURI != string.Empty)
uri = "http://" + destination.ServerURI + AgentPath() + aCircuit.AgentID + "/";
else
{ {
uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + aCircuit.AgentID + "/"; try
} {
catch (Exception e) uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + aCircuit.AgentID + "/";
{ }
m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent create. Reason: " + e.Message); catch (Exception e)
reason = e.Message; {
return false; m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent create. Reason: " + e.Message);
reason = e.Message;
return false;
}
} }
//Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri); //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri);

View File

@ -158,7 +158,7 @@ namespace OpenSim.Services.GridService
string host = "127.0.0.1"; string host = "127.0.0.1";
string portstr; string portstr;
string regionName = ""; string regionName = "";
uint port = 9000; uint port = 0;
string[] parts = mapName.Split(new char[] { ':' }); string[] parts = mapName.Split(new char[] { ':' });
if (parts.Length >= 1) if (parts.Length >= 1)
{ {
@ -177,18 +177,16 @@ namespace OpenSim.Services.GridService
regionName = parts[2]; regionName = parts[2];
} }
// Sanity check. //// Sanity check.
//IPAddress ipaddr = null; //try
try //{
{ // Util.GetHostFromDNS(host);
//ipaddr = Util.GetHostFromDNS(host); //}
Util.GetHostFromDNS(host); //catch
} //{
catch // reason = "Malformed hostname";
{ // return null;
reason = "Malformed hostname"; //}
return null;
}
GridRegion regInfo; GridRegion regInfo;
bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, out regInfo, out reason); bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, out regInfo, out reason);
@ -217,6 +215,11 @@ namespace OpenSim.Services.GridService
regInfo.RegionLocY = yloc; regInfo.RegionLocY = yloc;
regInfo.ScopeID = scopeID; regInfo.ScopeID = scopeID;
// Big HACK for Simian Grid !!!
// We need to clean up all URLs used in OpenSim !!!
if (externalHostName.Contains("/"))
regInfo.ServerURI = externalHostName;
try try
{ {
regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0); regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0);