aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Services/GridService/GridService.cs14
-rw-r--r--OpenSim/Services/Interfaces/IGridService.cs10
-rw-r--r--OpenSim/Tests/Clients/Grid/GridClient.cs5
3 files changed, 21 insertions, 8 deletions
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index 68b7cdf..991acf2 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -56,19 +56,21 @@ namespace OpenSim.Services.GridService
56 56
57 public bool RegisterRegion(UUID scopeID, GridRegion regionInfos) 57 public bool RegisterRegion(UUID scopeID, GridRegion regionInfos)
58 { 58 {
59 if (m_Database.Get(regionInfos.RegionID, scopeID) != null)
60 {
61 m_log.WarnFormat("[GRID SERVICE]: Region {0} already registered in scope {1}.", regionInfos.RegionID, scopeID);
62 return false;
63 }
64 // This needs better sanity testing. What if regionInfo is registering in 59 // This needs better sanity testing. What if regionInfo is registering in
65 // overlapping coords? 60 // overlapping coords?
66 if (m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID) != null) 61 RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID);
62 if ((region != null) && (region.RegionID != regionInfos.RegionID))
67 { 63 {
68 m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.", 64 m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.",
69 regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); 65 regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID);
70 return false; 66 return false;
71 } 67 }
68 if ((region != null) && (region.RegionID == regionInfos.RegionID) &&
69 ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY)))
70 {
71 // Region reregistering in other coordinates. Delete the old entry
72 m_Database.Delete(regionInfos.RegionID);
73 }
72 74
73 // Everything is ok, let's register 75 // Everything is ok, let's register
74 RegionData rdata = RegionInfo2RegionData(regionInfos); 76 RegionData rdata = RegionInfo2RegionData(regionInfos);
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs
index 513b1b0..ce432ab 100644
--- a/OpenSim/Services/Interfaces/IGridService.cs
+++ b/OpenSim/Services/Interfaces/IGridService.cs
@@ -267,6 +267,7 @@ namespace OpenSim.Services.Interfaces
267 kvp["serverIP"] = ExternalHostName; //ExternalEndPoint.Address.ToString(); 267 kvp["serverIP"] = ExternalHostName; //ExternalEndPoint.Address.ToString();
268 kvp["serverHttpPort"] = HttpPort.ToString(); 268 kvp["serverHttpPort"] = HttpPort.ToString();
269 kvp["serverURI"] = ServerURI; 269 kvp["serverURI"] = ServerURI;
270 kvp["serverPort"] = InternalEndPoint.Port.ToString();
270 271
271 return kvp; 272 return kvp;
272 } 273 }
@@ -287,7 +288,7 @@ namespace OpenSim.Services.Interfaces
287 288
288 if (kvp.ContainsKey("serverIP")) 289 if (kvp.ContainsKey("serverIP"))
289 { 290 {
290 int port = 0; 291 //int port = 0;
291 //Int32.TryParse((string)kvp["serverPort"], out port); 292 //Int32.TryParse((string)kvp["serverPort"], out port);
292 //IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["serverIP"]), port); 293 //IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["serverIP"]), port);
293 ExternalHostName = (string)kvp["serverIP"]; 294 ExternalHostName = (string)kvp["serverIP"];
@@ -295,6 +296,13 @@ namespace OpenSim.Services.Interfaces
295 else 296 else
296 ExternalHostName = "127.0.0.1"; 297 ExternalHostName = "127.0.0.1";
297 298
299 if (kvp.ContainsKey("serverPort"))
300 {
301 Int32 port = 0;
302 Int32.TryParse((string)kvp["serverPort"], out port);
303 InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port);
304 }
305
298 if (kvp.ContainsKey("serverHttpPort")) 306 if (kvp.ContainsKey("serverHttpPort"))
299 { 307 {
300 UInt32 port = 0; 308 UInt32 port = 0;
diff --git a/OpenSim/Tests/Clients/Grid/GridClient.cs b/OpenSim/Tests/Clients/Grid/GridClient.cs
index c56ebc3..941406e 100644
--- a/OpenSim/Tests/Clients/Grid/GridClient.cs
+++ b/OpenSim/Tests/Clients/Grid/GridClient.cs
@@ -137,6 +137,9 @@ namespace OpenSim.Tests.Clients.GridClient
137 else 137 else
138 Console.WriteLine("[GRID CLIENT]: GetRegionRange returned " + regions.Count + " regions"); 138 Console.WriteLine("[GRID CLIENT]: GetRegionRange returned " + regions.Count + " regions");
139 139
140 Console.Write("Proceed to deregister? Press enter...");
141 Console.ReadLine();
142
140 // Deregister them all 143 // Deregister them all
141 Console.WriteLine("[GRID CLIENT]: *** Deregistering region 1"); 144 Console.WriteLine("[GRID CLIENT]: *** Deregistering region 1");
142 success = m_Connector.DeregisterRegion(r1.RegionID); 145 success = m_Connector.DeregisterRegion(r1.RegionID);
@@ -166,7 +169,7 @@ namespace OpenSim.Tests.Clients.GridClient
166 region.RegionID = UUID.Random(); 169 region.RegionID = UUID.Random();
167 region.ExternalHostName = "127.0.0.1"; 170 region.ExternalHostName = "127.0.0.1";
168 region.HttpPort = 9000; 171 region.HttpPort = 9000;
169 region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0); 172 region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 9000);
170 173
171 return region; 174 return region;
172 } 175 }