aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
authorJonathan Freedman2010-10-21 23:22:15 -0400
committerJonathan Freedman2010-10-21 23:22:15 -0400
commitd4144bedb81346301162f1e20266561fea7b621e (patch)
treef33876acc79e1a5b688d95cc41628446d70297fa /OpenSim/Services
parentMerge branch 'master' of git://opensimulator.org/git/opensim (diff)
downloadopensim-SC-d4144bedb81346301162f1e20266561fea7b621e.zip
opensim-SC-d4144bedb81346301162f1e20266561fea7b621e.tar.gz
opensim-SC-d4144bedb81346301162f1e20266561fea7b621e.tar.bz2
opensim-SC-d4144bedb81346301162f1e20266561fea7b621e.tar.xz
* change the data exchanged within hypergrid transactions
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs35
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs2
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs73
-rw-r--r--OpenSim/Services/HypergridService/UserAgentService.cs10
4 files changed, 86 insertions, 34 deletions
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
index 4231be1..70bafda 100644
--- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
@@ -116,19 +116,19 @@ namespace OpenSim.Services.Connectors.Hypergrid
116 if (success) 116 if (success)
117 { 117 {
118 UUID.TryParse((string)hash["uuid"], out regionID); 118 UUID.TryParse((string)hash["uuid"], out regionID);
119 //m_log.Debug(">> HERE, uuid: " + regionID); 119 m_log.Debug(">> HERE, uuid: " + regionID);
120 if ((string)hash["handle"] != null) 120 if ((string)hash["handle"] != null)
121 { 121 {
122 realHandle = Convert.ToUInt64((string)hash["handle"]); 122 realHandle = Convert.ToUInt64((string)hash["handle"]);
123 //m_log.Debug(">> HERE, realHandle: " + realHandle); 123 m_log.Debug(">> HERE, realHandle: " + realHandle);
124 } 124 }
125 if (hash["region_image"] != null) { 125 if (hash["region_image"] != null) {
126 imageURL = (string)hash["region_image"]; 126 imageURL = (string)hash["region_image"];
127 //m_log.Debug(">> HERE, imageURL: " + imageURL); 127 m_log.Debug(">> HERE, imageURL: " + imageURL);
128 } 128 }
129 if (hash["external_name"] != null) { 129 if (hash["external_name"] != null) {
130 externalName = (string)hash["external_name"]; 130 externalName = (string)hash["external_name"];
131 //m_log.Debug(">> HERE, externalName: " + externalName); 131 m_log.Debug(">> HERE, externalName: " + externalName);
132 } 132 }
133 } 133 }
134 134
@@ -191,7 +191,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
191 paramList.Add(hash); 191 paramList.Add(hash);
192 192
193 XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); 193 XmlRpcRequest request = new XmlRpcRequest("get_region", paramList);
194 //m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI); 194 m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI);
195 XmlRpcResponse response = null; 195 XmlRpcResponse response = null;
196 try 196 try
197 { 197 {
@@ -199,7 +199,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
199 } 199 }
200 catch (Exception e) 200 catch (Exception e)
201 { 201 {
202 //m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message); 202 m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message);
203 return null; 203 return null;
204 } 204 }
205 205
@@ -221,41 +221,48 @@ namespace OpenSim.Services.Connectors.Hypergrid
221 GridRegion region = new GridRegion(); 221 GridRegion region = new GridRegion();
222 222
223 UUID.TryParse((string)hash["uuid"], out region.RegionID); 223 UUID.TryParse((string)hash["uuid"], out region.RegionID);
224 //m_log.Debug(">> HERE, uuid: " + region.RegionID); 224 m_log.Debug(">> HERE, uuid: " + region.RegionID);
225 int n = 0; 225 int n = 0;
226 if (hash["x"] != null) 226 if (hash["x"] != null)
227 { 227 {
228 Int32.TryParse((string)hash["x"], out n); 228 Int32.TryParse((string)hash["x"], out n);
229 region.RegionLocX = n; 229 region.RegionLocX = n;
230 //m_log.Debug(">> HERE, x: " + region.RegionLocX); 230 m_log.Debug(">> HERE, x: " + region.RegionLocX);
231 } 231 }
232 if (hash["y"] != null) 232 if (hash["y"] != null)
233 { 233 {
234 Int32.TryParse((string)hash["y"], out n); 234 Int32.TryParse((string)hash["y"], out n);
235 region.RegionLocY = n; 235 region.RegionLocY = n;
236 //m_log.Debug(">> HERE, y: " + region.RegionLocY); 236 m_log.Debug(">> HERE, y: " + region.RegionLocY);
237 } 237 }
238 if (hash["region_name"] != null) 238 if (hash["region_name"] != null)
239 { 239 {
240 region.RegionName = (string)hash["region_name"]; 240 region.RegionName = (string)hash["region_name"];
241 //m_log.Debug(">> HERE, region_name: " + region.RegionName); 241 m_log.Debug(">> HERE, region_name: " + region.RegionName);
242 } 242 }
243 if (hash["hostname"] != null) 243 if (hash["hostname"] != null) {
244 region.ExternalHostName = (string)hash["hostname"]; 244 region.ExternalHostName = (string)hash["hostname"];
245 //m_log.Debug(">> HERE, hostname: " + region.ExternalHostName); 245 m_log.Debug(">> HERE, hostname: " + region.ExternalHostName);
246 }
246 if (hash["http_port"] != null) 247 if (hash["http_port"] != null)
247 { 248 {
248 uint p = 0; 249 uint p = 0;
249 UInt32.TryParse((string)hash["http_port"], out p); 250 UInt32.TryParse((string)hash["http_port"], out p);
250 region.HttpPort = p; 251 region.HttpPort = p;
251 //m_log.Debug(">> HERE, http_port: " + region.HttpPort); 252 m_log.Debug(">> HERE, http_port: " + region.HttpPort);
252 } 253 }
253 if (hash["internal_port"] != null) 254 if (hash["internal_port"] != null)
254 { 255 {
255 int p = 0; 256 int p = 0;
256 Int32.TryParse((string)hash["internal_port"], out p); 257 Int32.TryParse((string)hash["internal_port"], out p);
257 region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); 258 region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p);
258 //m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint); 259 m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint);
260 }
261
262 if (hash["server_uri"] != null)
263 {
264 region.ServerURI = (string) hash["server_uri"];
265 m_log.Debug(">> HERE, server_uri: " + region.ServerURI);
259 } 266 }
260 267
261 // Successful return 268 // Successful return
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
index 247dd7e..0c41935 100644
--- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
@@ -232,12 +232,14 @@ namespace OpenSim.Services.Connectors.Hypergrid
232 m_log.Debug("[USER AGENT CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message); 232 m_log.Debug("[USER AGENT CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message);
233 } 233 }
234 // Add the input arguments 234 // Add the input arguments
235 args["gatekeeper_serveruri"] = OSD.FromString(gatekeeper.ServerURI);
235 args["gatekeeper_host"] = OSD.FromString(gatekeeper.ExternalHostName); 236 args["gatekeeper_host"] = OSD.FromString(gatekeeper.ExternalHostName);
236 args["gatekeeper_port"] = OSD.FromString(gatekeeper.HttpPort.ToString()); 237 args["gatekeeper_port"] = OSD.FromString(gatekeeper.HttpPort.ToString());
237 args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString()); 238 args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
238 args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); 239 args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
239 args["destination_name"] = OSD.FromString(destination.RegionName); 240 args["destination_name"] = OSD.FromString(destination.RegionName);
240 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); 241 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
242 args["destination_serveruri"] = OSD.FromString(destination.ServerURI);
241 243
242 // 10/3/2010 244 // 10/3/2010
243 // I added the client_ip up to the regular AgentCircuitData, so this doesn't need to be here. 245 // I added the client_ip up to the regular AgentCircuitData, so this doesn't need to be here.
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index 74e864b..c273d21 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -126,11 +126,12 @@ namespace OpenSim.Services.GridService
126 126
127 if (MainConsole.Instance != null) 127 if (MainConsole.Instance != null)
128 { 128 {
129 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", 129 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region <Xloc> <Yloc> <ServerURI> [<RemoteRegionName>]", "Link a HyperGrid Region", RunCommand);
130 "link-region <Xloc> <Yloc> <RegionIP> <RegionPort> [<RegionServerURI] [<RemoteRegionName>] <cr>", 130 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "legacy-link-region",
131 "Link a hypergrid region", RunCommand); 131 "legacy-link-region <Xloc> <Yloc> <RegionIP> <RegionPort> [<RemoteRegionName>]",
132 "Link a hypergrid region (deprecated)", RunCommand);
132 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", 133 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region",
133 "unlink-region <local name> or <HostName>:<HttpPort> <cr>", 134 "unlink-region <local name>",
134 "Unlink a hypergrid region", RunCommand); 135 "Unlink a hypergrid region", RunCommand);
135 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>", 136 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>",
136 "Set local coordinate to map HG regions to", RunCommand); 137 "Set local coordinate to map HG regions to", RunCommand);
@@ -198,27 +199,33 @@ namespace OpenSim.Services.GridService
198 199
199 return null; 200 return null;
200 } 201 }
202
201 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) 203 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason)
202 { 204 {
205 return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, out regInfo, out reason);
206 }
207
208 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, string serverURI, out GridRegion regInfo, out string reason)
209 {
203 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); 210 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc);
204 211
205 reason = string.Empty; 212 reason = string.Empty;
206 regInfo = new GridRegion(); 213 regInfo = new GridRegion();
207 regInfo.RegionName = externalRegionName; 214 if ( externalPort > 0)
208 regInfo.HttpPort = externalPort; 215 regInfo.HttpPort = externalPort;
209 regInfo.ExternalHostName = externalHostName; 216 else
217 regInfo.HttpPort = 0;
218 if ( externalHostName != null)
219 regInfo.ExternalHostName = externalHostName;
220 else
221 regInfo.ExternalHostName = "0.0.0.0";
222 if ( serverURI != null)
223 regInfo.ServerURI = serverURI;
224
210 regInfo.RegionLocX = xloc; 225 regInfo.RegionLocX = xloc;
211 regInfo.RegionLocY = yloc; 226 regInfo.RegionLocY = yloc;
212 regInfo.ScopeID = scopeID; 227 regInfo.ScopeID = scopeID;
213 228
214 // Big HACK for Simian Grid !!!
215 // We need to clean up all URLs used in OpenSim !!!
216 if (externalHostName.Contains("/")) {
217 regInfo.ServerURI = externalHostName;
218 } else {
219 regInfo.ServerURI = "http://" + externalHostName + ":" + externalPort.ToString();
220 }
221
222 try 229 try
223 { 230 {
224 regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0); 231 regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0);
@@ -249,9 +256,14 @@ namespace OpenSim.Services.GridService
249 } 256 }
250 257
251 regInfo.RegionID = regionID; 258 regInfo.RegionID = regionID;
252 if (regInfo.RegionName == string.Empty)
253 regInfo.RegionName = regInfo.ExternalHostName;
254 259
260 if ( externalName == string.Empty )
261 regInfo.RegionName = regInfo.ServerURI;
262 else
263 regInfo.RegionName = externalName;
264
265 m_log.Debug("naming linked region " + regInfo.RegionName);
266
255 // Try get the map image 267 // Try get the map image
256 //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); 268 //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL);
257 // I need a texture that works for this... the one I tried doesn't seem to be working 269 // I need a texture that works for this... the one I tried doesn't seem to be working
@@ -433,6 +445,21 @@ namespace OpenSim.Services.GridService
433 RunHGCommand(command, cmdparams); 445 RunHGCommand(command, cmdparams);
434 446
435 } 447 }
448
449 private void RunLinkRegionCommand(string[] cmdparams)
450 {
451 int xloc, yloc;
452 string serverURI;
453 string remoteName = null;
454 xloc = Convert.ToInt32(cmdparams[0]) * (int)Constants.RegionSize;
455 yloc = Convert.ToInt32(cmdparams[1]) * (int)Constants.RegionSize;
456 serverURI = cmdparams[2];
457 if (cmdparams.Length == 4)
458 remoteName = cmdparams[3];
459 string reason = string.Empty;
460 GridRegion regInfo;
461 TryCreateLink(UUID.Zero, xloc, yloc, remoteName, 0, null, serverURI, out regInfo, out reason);
462 }
436 463
437 private void RunHGCommand(string command, string[] cmdparams) 464 private void RunHGCommand(string command, string[] cmdparams)
438 { 465 {
@@ -456,6 +483,18 @@ namespace OpenSim.Services.GridService
456 } 483 }
457 else if (command.Equals("link-region")) 484 else if (command.Equals("link-region"))
458 { 485 {
486 if (cmdparams.Length > 0 && cmdparams.Length < 5)
487 {
488 RunLinkRegionCommand(cmdparams);
489 }
490 else
491 {
492 LinkRegionCmdUsage();
493 }
494 return;
495 }
496 else if (command.Equals("legacy-link-region"))
497 {
459 if (cmdparams.Length < 3) 498 if (cmdparams.Length < 3)
460 { 499 {
461 if ((cmdparams.Length == 1) || (cmdparams.Length == 2)) 500 if ((cmdparams.Length == 1) || (cmdparams.Length == 2))
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs
index aed2dc8..eb19fe2 100644
--- a/OpenSim/Services/HypergridService/UserAgentService.cs
+++ b/OpenSim/Services/HypergridService/UserAgentService.cs
@@ -134,12 +134,14 @@ namespace OpenSim.Services.HypergridService
134 public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint clientIP, out string reason) 134 public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint clientIP, out string reason)
135 { 135 {
136 m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", 136 m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}",
137 agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), 137 agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ServerURI);
138 gatekeeper.ExternalHostName +":"+ gatekeeper.HttpPort);
139 m_log.Debug("gatekeeper serveruri -> " + gatekeeper.ServerURI );
140 138
139 m_log.Debug("LATG final server uri -> " + finalDestination.ServerURI );
141 // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination 140 // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination
142 GridRegion region = new GridRegion(gatekeeper); 141 GridRegion region = new GridRegion(gatekeeper);
142 region.ServerURI = gatekeeper.ServerURI;
143 region.ExternalHostName = finalDestination.ExternalHostName;
144 region.InternalEndPoint = finalDestination.InternalEndPoint;
143 region.RegionName = finalDestination.RegionName; 145 region.RegionName = finalDestination.RegionName;
144 region.RegionID = finalDestination.RegionID; 146 region.RegionID = finalDestination.RegionID;
145 region.RegionLocX = finalDestination.RegionLocX; 147 region.RegionLocX = finalDestination.RegionLocX;
@@ -149,6 +151,8 @@ namespace OpenSim.Services.HypergridService
149 agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random(); 151 agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random();
150 TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region); 152 TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region);
151 153
154 m_log.Debug("region ServerURI -> " + region.ServerURI);
155
152 bool success = false; 156 bool success = false;
153 string myExternalIP = string.Empty; 157 string myExternalIP = string.Empty;
154 string gridName = gatekeeper.ServerURI; 158 string gridName = gatekeeper.ServerURI;