diff options
author | lbsa71 | 2009-03-10 09:05:06 +0000 |
---|---|---|
committer | lbsa71 | 2009-03-10 09:05:06 +0000 |
commit | 1b34b94331ca810ed53669699abcff3a6a99de83 (patch) | |
tree | 9a4f1c55c287f733b373a46c5a9aa44c0932f5bf | |
parent | From: Alan Webb <alan_webb@us.ibm.com> (diff) | |
download | opensim-SC_OLD-1b34b94331ca810ed53669699abcff3a6a99de83.zip opensim-SC_OLD-1b34b94331ca810ed53669699abcff3a6a99de83.tar.gz opensim-SC_OLD-1b34b94331ca810ed53669699abcff3a6a99de83.tar.bz2 opensim-SC_OLD-1b34b94331ca810ed53669699abcff3a6a99de83.tar.xz |
* Refactored out Create() methods to ensure proper transformation between RegionProfileData and RegionInfo
* Created ToRegionInfo method, still not using it pending peer review.
* This is a preparatory commit for a subsequent login service refactoring.
-rw-r--r-- | OpenSim/Data/RegionProfileData.cs | 26 | ||||
-rw-r--r-- | OpenSim/Data/RegionProfileServiceProxy.cs | 25 | ||||
-rw-r--r-- | OpenSim/Framework/RegionInfo.cs | 13 | ||||
-rw-r--r-- | OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | 24 |
4 files changed, 60 insertions, 28 deletions
diff --git a/OpenSim/Data/RegionProfileData.cs b/OpenSim/Data/RegionProfileData.cs index 0b757f3..5476233 100644 --- a/OpenSim/Data/RegionProfileData.cs +++ b/OpenSim/Data/RegionProfileData.cs | |||
@@ -279,6 +279,30 @@ namespace OpenSim.Data | |||
279 | get { return originUUID; } | 279 | get { return originUUID; } |
280 | set { originUUID = value; } | 280 | set { originUUID = value; } |
281 | } | 281 | } |
282 | 282 | ||
283 | public RegionInfo ToRegionInfo( ) | ||
284 | { | ||
285 | return RegionInfo.Create(UUID, regionName, regionLocX, regionLocY, serverIP, httpPort, serverPort, remotingPort); | ||
286 | } | ||
287 | |||
288 | public static RegionProfileData Create(UUID regionID, string regionName, uint locX, uint locY, string externalHostName, uint regionPort, uint httpPort, uint remotingPort, string serverUri) | ||
289 | { | ||
290 | RegionProfileData regionProfile; | ||
291 | regionProfile = new RegionProfileData(); | ||
292 | regionProfile.regionLocX = locX; | ||
293 | regionProfile.regionLocY = locY; | ||
294 | regionProfile.regionHandle = | ||
295 | Utils.UIntsToLong((regionProfile.regionLocX * Constants.RegionSize), | ||
296 | (regionProfile.regionLocY*Constants.RegionSize)); | ||
297 | regionProfile.serverIP = externalHostName; | ||
298 | regionProfile.serverPort = regionPort; | ||
299 | regionProfile.httpPort = httpPort; | ||
300 | regionProfile.remotingPort = remotingPort; | ||
301 | regionProfile.serverURI = serverUri; | ||
302 | regionProfile.httpServerURI = "http://" + externalHostName + ":" + httpPort + "/"; | ||
303 | regionProfile.UUID = regionID; | ||
304 | regionProfile.regionName = regionName; | ||
305 | return regionProfile; | ||
306 | } | ||
283 | } | 307 | } |
284 | } | 308 | } |
diff --git a/OpenSim/Data/RegionProfileServiceProxy.cs b/OpenSim/Data/RegionProfileServiceProxy.cs index 126e363..da71936 100644 --- a/OpenSim/Data/RegionProfileServiceProxy.cs +++ b/OpenSim/Data/RegionProfileServiceProxy.cs | |||
@@ -56,20 +56,17 @@ namespace OpenSim.Data | |||
56 | 56 | ||
57 | if (!responseData.ContainsKey("error")) | 57 | if (!responseData.ContainsKey("error")) |
58 | { | 58 | { |
59 | simData = new RegionProfileData(); | 59 | uint locX = Convert.ToUInt32((string)responseData["region_locx"]); |
60 | simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]); | 60 | uint locY = Convert.ToUInt32((string)responseData["region_locy"]); |
61 | simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]); | 61 | string externalHostName = (string)responseData["sim_ip"]; |
62 | simData.regionHandle = | 62 | uint simPort = Convert.ToUInt32((string)responseData["sim_port"]); |
63 | Utils.UIntsToLong((simData.regionLocX * Constants.RegionSize), | 63 | uint httpPort = Convert.ToUInt32((string)responseData["http_port"]); |
64 | (simData.regionLocY*Constants.RegionSize)); | 64 | uint remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); |
65 | simData.serverIP = (string) responseData["sim_ip"]; | 65 | string serverUri = (string)responseData["server_uri"]; |
66 | simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]); | 66 | UUID regionID = new UUID((string)responseData["region_UUID"]); |
67 | simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]); | 67 | string regionName = (string)responseData["region_name"]; |
68 | simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); | 68 | |
69 | simData.serverURI = (string) responseData["server_uri"]; | 69 | simData = RegionProfileData.Create(regionID, regionName, locX, locY, externalHostName, simPort, httpPort, remotingPort, serverUri); |
70 | simData.httpServerURI = "http://" + (string)responseData["sim_ip"] + ":" + simData.httpPort.ToString() + "/"; | ||
71 | simData.UUID = new UUID((string) responseData["region_UUID"]); | ||
72 | simData.regionName = (string) responseData["region_name"]; | ||
73 | } | 70 | } |
74 | 71 | ||
75 | return simData; | 72 | return simData; |
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 0929699..c958c68 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -675,5 +675,18 @@ namespace OpenSim.Framework | |||
675 | if (args["proxy_url"] != null) | 675 | if (args["proxy_url"] != null) |
676 | proxyUrl = args["proxy_url"].AsString(); | 676 | proxyUrl = args["proxy_url"].AsString(); |
677 | } | 677 | } |
678 | |||
679 | public static RegionInfo Create(UUID regionID, string regionName, uint regX, uint regY, string externalHostName, uint httpPort, uint simPort, uint remotingPort) | ||
680 | { | ||
681 | RegionInfo regionInfo; | ||
682 | IPEndPoint neighbourInternalEndPoint = new IPEndPoint(Util.GetHostFromDNS(externalHostName), (int)simPort); | ||
683 | regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, externalHostName); | ||
684 | regionInfo.RemotingPort = remotingPort; | ||
685 | regionInfo.RemotingAddress = externalHostName; | ||
686 | regionInfo.HttpPort = httpPort; | ||
687 | regionInfo.RegionID = regionID; | ||
688 | regionInfo.RegionName = regionName; | ||
689 | return regionInfo; | ||
690 | } | ||
678 | } | 691 | } |
679 | } | 692 | } |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 5f00f15..1a72f31 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | |||
@@ -405,24 +405,22 @@ namespace OpenSim.Region.Communications.OGS1 | |||
405 | uint regX = Convert.ToUInt32((string) responseData["region_locx"]); | 405 | uint regX = Convert.ToUInt32((string) responseData["region_locx"]); |
406 | uint regY = Convert.ToUInt32((string) responseData["region_locy"]); | 406 | uint regY = Convert.ToUInt32((string) responseData["region_locy"]); |
407 | string externalHostName = (string) responseData["sim_ip"]; | 407 | string externalHostName = (string) responseData["sim_ip"]; |
408 | uint port = Convert.ToUInt32(responseData["sim_port"]); | 408 | uint simPort = Convert.ToUInt32(responseData["sim_port"]); |
409 | // string externalUri = (string) responseData["sim_uri"]; | 409 | string regionName = (string)responseData["region_name"]; |
410 | 410 | UUID regionID = new UUID((string)responseData["region_UUID"]); | |
411 | //IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port); | 411 | uint remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); |
412 | IPEndPoint neighbourInternalEndPoint = new IPEndPoint(Util.GetHostFromDNS(externalHostName), (int)port); | ||
413 | 412 | ||
414 | regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, externalHostName); | 413 | uint httpPort = 9000; |
415 | |||
416 | regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); | ||
417 | regionInfo.RemotingAddress = externalHostName; | ||
418 | |||
419 | if (responseData.ContainsKey("http_port")) | 414 | if (responseData.ContainsKey("http_port")) |
420 | { | 415 | { |
421 | regionInfo.HttpPort = Convert.ToUInt32((string) responseData["http_port"]); | 416 | httpPort = Convert.ToUInt32((string)responseData["http_port"]); |
422 | } | 417 | } |
423 | 418 | ||
424 | regionInfo.RegionID = new UUID((string) responseData["region_UUID"]); | 419 | |
425 | regionInfo.RegionName = (string) responseData["region_name"]; | 420 | // string externalUri = (string) responseData["sim_uri"]; |
421 | |||
422 | //IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port); | ||
423 | regionInfo = RegionInfo.Create(regionID, regionName, regX, regY, externalHostName, httpPort, simPort, remotingPort); | ||
426 | 424 | ||
427 | lock (m_remoteRegionInfoCache) | 425 | lock (m_remoteRegionInfoCache) |
428 | { | 426 | { |