aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs8
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs8
-rw-r--r--OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs20
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs6
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs10
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs17
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs6
-rw-r--r--OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs16
-rw-r--r--OpenSim/Services/Connectors/Grid/GridServiceConnector.cs18
-rw-r--r--OpenSim/Services/GridService/GridService.cs31
-rw-r--r--OpenSim/Services/Interfaces/IGridService.cs2
-rw-r--r--OpenSim/Tests/Clients/Grid/GridClient.cs17
13 files changed, 113 insertions, 48 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
index f9cd90f..131febd 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
@@ -200,7 +200,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
200 200
201 #region IGridService 201 #region IGridService
202 202
203 public bool RegisterRegion(UUID scopeID, GridRegion regionInfo) 203 public string RegisterRegion(UUID scopeID, GridRegion regionInfo)
204 { 204 {
205 // Region doesn't exist here. Trying to link remote region 205 // Region doesn't exist here. Trying to link remote region
206 if (regionInfo.RegionID.Equals(UUID.Zero)) 206 if (regionInfo.RegionID.Equals(UUID.Zero))
@@ -215,12 +215,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
215 215
216 // Try get the map image 216 // Try get the map image
217 m_HypergridServiceConnector.GetMapImage(regionInfo); 217 m_HypergridServiceConnector.GetMapImage(regionInfo);
218 return true; 218 return String.Empty;
219 } 219 }
220 else 220 else
221 { 221 {
222 m_log.Info("[HGrid]: No such region " + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "(" + regionInfo.InternalEndPoint.Port + ")"); 222 m_log.Info("[HGrid]: No such region " + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "(" + regionInfo.InternalEndPoint.Port + ")");
223 return false; 223 return "No such region";
224 } 224 }
225 // Note that these remote regions aren't registered in localBackend, so return null, no local listeners 225 // Note that these remote regions aren't registered in localBackend, so return null, no local listeners
226 } 226 }
@@ -469,7 +469,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
469 } 469 }
470 470
471 // Finally, link it 471 // Finally, link it
472 if (!RegisterRegion(UUID.Zero, regInfo)) 472 if (RegisterRegion(UUID.Zero, regInfo) != String.Empty)
473 { 473 {
474 m_log.Warn("[HGrid]: Unable to link region"); 474 m_log.Warn("[HGrid]: Unable to link region");
475 return false; 475 return false;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
index 1c72488..144b5a4 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
@@ -169,7 +169,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
169 169
170 #region IGridService 170 #region IGridService
171 171
172 public bool RegisterRegion(UUID scopeID, GridRegion regionInfo) 172 public string RegisterRegion(UUID scopeID, GridRegion regionInfo)
173 { 173 {
174 return m_GridService.RegisterRegion(scopeID, regionInfo); 174 return m_GridService.RegisterRegion(scopeID, regionInfo);
175 } 175 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
index 72c00fc..391e7c8 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
@@ -135,12 +135,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
135 135
136 #region IGridService 136 #region IGridService
137 137
138 public override bool RegisterRegion(UUID scopeID, GridRegion regionInfo) 138 public override string RegisterRegion(UUID scopeID, GridRegion regionInfo)
139 { 139 {
140 if (m_LocalGridService.RegisterRegion(scopeID, regionInfo)) 140 string msg = m_LocalGridService.RegisterRegion(scopeID, regionInfo);
141
142 if (msg == String.Empty)
141 return base.RegisterRegion(scopeID, regionInfo); 143 return base.RegisterRegion(scopeID, regionInfo);
142 144
143 return false; 145 return msg;
144 } 146 }
145 147
146 public override bool DeregisterRegion(UUID regionID) 148 public override bool DeregisterRegion(UUID regionID)
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
index 5cdf191..d7fa316 100644
--- a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
@@ -32,13 +32,29 @@ namespace OpenSim.Region.Framework.Interfaces
32{ 32{
33 public delegate void ScriptCommand(UUID script, string id, string module, string command, string k); 33 public delegate void ScriptCommand(UUID script, string id, string module, string command, string k);
34 34
35 /// <summary>
36 /// Interface for communication between OpenSim modules and in-world scripts
37 /// </summary>
38 ///
39 /// See OpenSim.Region.ScriptEngine.Shared.Api.MOD_Api.modSendCommand() for information on receiving messages
40 /// from scripts in OpenSim modules.
35 public interface IScriptModuleComms 41 public interface IScriptModuleComms
36 { 42 {
43 /// <summary>
44 /// Modules can subscribe to this event to receive command invocations from in-world scripts
45 /// </summary>
37 event ScriptCommand OnScriptCommand; 46 event ScriptCommand OnScriptCommand;
38 47
39 void DispatchReply(UUID script, int code, string text, string k); 48 /// <summary>
49 /// Send a link_message event to an in-world script
50 /// </summary>
51 /// <param name="scriptId"></param>
52 /// <param name="code"></param>
53 /// <param name="text"></param>
54 /// <param name="key"></param>
55 void DispatchReply(UUID scriptId, int code, string text, string key);
40 56
41 // For use ONLY by the script API 57 // For use ONLY by the script API
42 void RaiseEvent(UUID script, string id, string module, string command, string k); 58 void RaiseEvent(UUID script, string id, string module, string command, string key);
43 } 59 }
44} 60}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 8ac4bc4..db21bf9 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1589,9 +1589,9 @@ namespace OpenSim.Region.Framework.Scenes
1589 //m_sceneGridService.RegisterRegion(m_interregionCommsOut, RegionInfo); 1589 //m_sceneGridService.RegisterRegion(m_interregionCommsOut, RegionInfo);
1590 1590
1591 GridRegion region = new GridRegion(RegionInfo); 1591 GridRegion region = new GridRegion(RegionInfo);
1592 bool success = GridService.RegisterRegion(RegionInfo.ScopeID, region); 1592 string error = GridService.RegisterRegion(RegionInfo.ScopeID, region);
1593 if (!success) 1593 if (error != String.Empty)
1594 throw new Exception("Can't register with grid"); 1594 throw new Exception(error);
1595 1595
1596 m_sceneGridService.SetScene(this); 1596 m_sceneGridService.SetScene(this);
1597 m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo); 1597 m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo);
diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs
index 3c5e8c9..b3fa07f 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs
@@ -220,8 +220,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
220 220
221 // Fail if fundamental information is still missing 221 // Fail if fundamental information is still missing
222 222
223 if (cs.Server == null || cs.IrcChannel == null || cs.BaseNickname == null || cs.User == null) 223 if (cs.Server == null)
224 throw new Exception(String.Format("[IRC-Channel-{0}] Invalid configuration for region {1}", cs.idn, rs.Region)); 224 throw new Exception(String.Format("[IRC-Channel-{0}] Invalid configuration for region {1}: server missing", cs.idn, rs.Region));
225 else if (cs.IrcChannel == null)
226 throw new Exception(String.Format("[IRC-Channel-{0}] Invalid configuration for region {1}: channel missing", cs.idn, rs.Region));
227 else if (cs.BaseNickname == null)
228 throw new Exception(String.Format("[IRC-Channel-{0}] Invalid configuration for region {1}: nick missing", cs.idn, rs.Region));
229 else if (cs.User == null)
230 throw new Exception(String.Format("[IRC-Channel-{0}] Invalid configuration for region {1}: user missing", cs.idn, rs.Region));
225 231
226 m_log.InfoFormat("[IRC-Channel-{0}] Configuration for Region {1} is valid", cs.idn, rs.Region); 232 m_log.InfoFormat("[IRC-Channel-{0}] Configuration for Region {1} is valid", cs.idn, rs.Region);
227 m_log.InfoFormat("[IRC-Channel-{0}] Server = {1}", cs.idn, cs.Server); 233 m_log.InfoFormat("[IRC-Channel-{0}] Server = {1}", cs.idn, cs.Server);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 42c52dd..085d61f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -7456,23 +7456,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7456 public LSL_Integer llGetNumberOfPrims() 7456 public LSL_Integer llGetNumberOfPrims()
7457 { 7457 {
7458 m_host.AddScriptLPS(1); 7458 m_host.AddScriptLPS(1);
7459 ScenePresence[] presences = World.GetScenePresences();
7460 if (presences.Length == 0)
7461 return 0;
7462
7463 int avatarCount = 0; 7459 int avatarCount = 0;
7464 for (int i = 0; i < presences.Length; i++) 7460 World.ForEachScenePresence(delegate(ScenePresence presence)
7465 { 7461 {
7466 ScenePresence presence = presences[i]; 7462 if (!presence.IsChildAgent && presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID))
7467
7468 if (!presence.IsChildAgent && presence.ParentID != 0)
7469 {
7470 if (m_host.ParentGroup.HasChildPrim(presence.ParentID))
7471 {
7472 avatarCount++; 7463 avatarCount++;
7473 } 7464 });
7474 }
7475 }
7476 7465
7477 return m_host.ParentGroup.PrimCount + avatarCount; 7466 return m_host.ParentGroup.PrimCount + avatarCount;
7478 } 7467 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index a5be251..1ddba1e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1987,6 +1987,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1987 1987
1988 return (int)pws; 1988 return (int)pws;
1989 } 1989 }
1990
1990 public void osSetSpeed(string UUID, float SpeedModifier) 1991 public void osSetSpeed(string UUID, float SpeedModifier)
1991 { 1992 {
1992 CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); 1993 CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed");
@@ -1994,6 +1995,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1994 ScenePresence avatar = World.GetScenePresence(new UUID(UUID)); 1995 ScenePresence avatar = World.GetScenePresence(new UUID(UUID));
1995 avatar.SpeedModifier = SpeedModifier; 1996 avatar.SpeedModifier = SpeedModifier;
1996 } 1997 }
1998
1997 public void osKickAvatar(string FirstName,string SurName,string alert) 1999 public void osKickAvatar(string FirstName,string SurName,string alert)
1998 { 2000 {
1999 CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); 2001 CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar");
@@ -2014,6 +2016,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2014 } 2016 }
2015 } 2017 }
2016 } 2018 }
2019
2017 public void osCauseDamage(string avatar, double damage) 2020 public void osCauseDamage(string avatar, double damage)
2018 { 2021 {
2019 CheckThreatLevel(ThreatLevel.High, "osCauseDamage"); 2022 CheckThreatLevel(ThreatLevel.High, "osCauseDamage");
@@ -2041,6 +2044,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2041 } 2044 }
2042 } 2045 }
2043 } 2046 }
2047
2044 public void osCauseHealing(string avatar, double healing) 2048 public void osCauseHealing(string avatar, double healing)
2045 { 2049 {
2046 CheckThreatLevel(ThreatLevel.High, "osCauseHealing"); 2050 CheckThreatLevel(ThreatLevel.High, "osCauseHealing");
@@ -2065,4 +2069,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2065 } 2069 }
2066 } 2070 }
2067 } 2071 }
2068} 2072} \ No newline at end of file
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
index d99b791..85a8738 100644
--- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
@@ -156,14 +156,14 @@ namespace OpenSim.Server.Handlers.Grid
156 m_log.DebugFormat("[GRID HANDLER]: exception unpacking region data: {0}", e); 156 m_log.DebugFormat("[GRID HANDLER]: exception unpacking region data: {0}", e);
157 } 157 }
158 158
159 bool result = false; 159 string result = "Error communicating with grid service";
160 if (rinfo != null) 160 if (rinfo != null)
161 result = m_GridService.RegisterRegion(scopeID, rinfo); 161 result = m_GridService.RegisterRegion(scopeID, rinfo);
162 162
163 if (result) 163 if (result == String.Empty)
164 return SuccessResult(); 164 return SuccessResult();
165 else 165 else
166 return FailureResult(); 166 return FailureResult(result);
167 } 167 }
168 168
169 byte[] Deregister(Dictionary<string, object> request) 169 byte[] Deregister(Dictionary<string, object> request)
@@ -432,6 +432,11 @@ namespace OpenSim.Server.Handlers.Grid
432 432
433 private byte[] FailureResult() 433 private byte[] FailureResult()
434 { 434 {
435 return FailureResult(String.Empty);
436 }
437
438 private byte[] FailureResult(string msg)
439 {
435 XmlDocument doc = new XmlDocument(); 440 XmlDocument doc = new XmlDocument();
436 441
437 XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, 442 XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration,
@@ -449,6 +454,11 @@ namespace OpenSim.Server.Handlers.Grid
449 454
450 rootElement.AppendChild(result); 455 rootElement.AppendChild(result);
451 456
457 XmlElement message = doc.CreateElement("", "Message", "");
458 message.AppendChild(doc.CreateTextNode(msg));
459
460 rootElement.AppendChild(message);
461
452 return DocToBytes(doc); 462 return DocToBytes(doc);
453 } 463 }
454 464
diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
index 99aa3fb..04c7c53 100644
--- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
@@ -86,7 +86,7 @@ namespace OpenSim.Services.Connectors
86 86
87 #region IGridService 87 #region IGridService
88 88
89 public virtual bool RegisterRegion(UUID scopeID, GridRegion regionInfo) 89 public virtual string RegisterRegion(UUID scopeID, GridRegion regionInfo)
90 { 90 {
91 Dictionary<string, object> rinfo = regionInfo.ToKeyValuePairs(); 91 Dictionary<string, object> rinfo = regionInfo.ToKeyValuePairs();
92 Dictionary<string, object> sendData = new Dictionary<string,object>(); 92 Dictionary<string, object> sendData = new Dictionary<string,object>();
@@ -110,11 +110,23 @@ namespace OpenSim.Services.Connectors
110 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 110 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
111 111
112 if (replyData.ContainsKey("Result")&& (replyData["Result"].ToString().ToLower() == "success")) 112 if (replyData.ContainsKey("Result")&& (replyData["Result"].ToString().ToLower() == "success"))
113 return true; 113 {
114 return String.Empty;
115 }
116 else if (replyData.ContainsKey("Result")&& (replyData["Result"].ToString().ToLower() == "failure"))
117 {
118 m_log.DebugFormat("[GRID CONNECTOR]: Registration failed: {0}", replyData["Message"].ToString());
119 return replyData["Message"].ToString();
120 }
114 else if (!replyData.ContainsKey("Result")) 121 else if (!replyData.ContainsKey("Result"))
122 {
115 m_log.DebugFormat("[GRID CONNECTOR]: reply data does not contain result field"); 123 m_log.DebugFormat("[GRID CONNECTOR]: reply data does not contain result field");
124 }
116 else 125 else
126 {
117 m_log.DebugFormat("[GRID CONNECTOR]: unexpected result {0}", replyData["Result"].ToString()); 127 m_log.DebugFormat("[GRID CONNECTOR]: unexpected result {0}", replyData["Result"].ToString());
128 return "Unexpected result "+replyData["Result"].ToString();
129 }
118 130
119 } 131 }
120 else 132 else
@@ -125,7 +137,7 @@ namespace OpenSim.Services.Connectors
125 m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message); 137 m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
126 } 138 }
127 139
128 return false; 140 return "Error communicating with grid service";
129 } 141 }
130 142
131 public virtual bool DeregisterRegion(UUID regionID) 143 public virtual bool DeregisterRegion(UUID regionID)
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index 86815e5..7749c37 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -46,15 +46,23 @@ namespace OpenSim.Services.GridService
46 LogManager.GetLogger( 46 LogManager.GetLogger(
47 MethodBase.GetCurrentMethod().DeclaringType); 47 MethodBase.GetCurrentMethod().DeclaringType);
48 48
49 protected bool m_AllowDuplicateNames = false;
50
49 public GridService(IConfigSource config) 51 public GridService(IConfigSource config)
50 : base(config) 52 : base(config)
51 { 53 {
52 m_log.DebugFormat("[GRID SERVICE]: Starting..."); 54 m_log.DebugFormat("[GRID SERVICE]: Starting...");
55
56 IConfig gridConfig = config.Configs["GridService"];
57 if (gridConfig != null)
58 {
59 m_AllowDuplicateNames = gridConfig.GetBoolean("AllowDuplicateNames", m_AllowDuplicateNames);
60 }
53 } 61 }
54 62
55 #region IGridService 63 #region IGridService
56 64
57 public bool RegisterRegion(UUID scopeID, GridRegion regionInfos) 65 public string RegisterRegion(UUID scopeID, GridRegion regionInfos)
58 { 66 {
59 // This needs better sanity testing. What if regionInfo is registering in 67 // This needs better sanity testing. What if regionInfo is registering in
60 // overlapping coords? 68 // overlapping coords?
@@ -63,7 +71,7 @@ namespace OpenSim.Services.GridService
63 { 71 {
64 m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.", 72 m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.",
65 regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); 73 regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID);
66 return false; 74 return "Region overlaps another region";
67 } 75 }
68 if ((region != null) && (region.RegionID == regionInfos.RegionID) && 76 if ((region != null) && (region.RegionID == regionInfos.RegionID) &&
69 ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY))) 77 ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY)))
@@ -82,6 +90,23 @@ namespace OpenSim.Services.GridService
82 } 90 }
83 } 91 }
84 92
93 if (!m_AllowDuplicateNames)
94 {
95 List<RegionData> dupe = m_Database.Get(regionInfos.RegionName, scopeID);
96 if (dupe != null && dupe.Count > 0)
97 {
98 foreach (RegionData d in dupe)
99 {
100 if (d.RegionID != regionInfos.RegionID)
101 {
102 m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register duplicate name with ID {1}.",
103 regionInfos.RegionName, regionInfos.RegionID);
104 return "Duplicate region name";
105 }
106 }
107 }
108 }
109
85 // Everything is ok, let's register 110 // Everything is ok, let's register
86 RegionData rdata = RegionInfo2RegionData(regionInfos); 111 RegionData rdata = RegionInfo2RegionData(regionInfos);
87 rdata.ScopeID = scopeID; 112 rdata.ScopeID = scopeID;
@@ -97,7 +122,7 @@ namespace OpenSim.Services.GridService
97 m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) registered successfully at {2}-{3}", 122 m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) registered successfully at {2}-{3}",
98 regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY); 123 regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY);
99 124
100 return true; 125 return String.Empty;
101 } 126 }
102 127
103 public bool DeregisterRegion(UUID regionID) 128 public bool DeregisterRegion(UUID regionID)
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs
index e69e4cd..5135f6d 100644
--- a/OpenSim/Services/Interfaces/IGridService.cs
+++ b/OpenSim/Services/Interfaces/IGridService.cs
@@ -42,7 +42,7 @@ namespace OpenSim.Services.Interfaces
42 /// <param name="regionInfos"> </param> 42 /// <param name="regionInfos"> </param>
43 /// <returns></returns> 43 /// <returns></returns>
44 /// <exception cref="System.Exception">Thrown if region registration failed</exception> 44 /// <exception cref="System.Exception">Thrown if region registration failed</exception>
45 bool RegisterRegion(UUID scopeID, GridRegion regionInfos); 45 string RegisterRegion(UUID scopeID, GridRegion regionInfos);
46 46
47 /// <summary> 47 /// <summary>
48 /// Deregister a region with the grid service. 48 /// Deregister a region with the grid service.
diff --git a/OpenSim/Tests/Clients/Grid/GridClient.cs b/OpenSim/Tests/Clients/Grid/GridClient.cs
index 972c0aa..8e33373 100644
--- a/OpenSim/Tests/Clients/Grid/GridClient.cs
+++ b/OpenSim/Tests/Clients/Grid/GridClient.cs
@@ -63,27 +63,28 @@ namespace OpenSim.Tests.Clients.GridClient
63 GridRegion r3 = CreateRegion("Test Region 3", 1005, 1000); 63 GridRegion r3 = CreateRegion("Test Region 3", 1005, 1000);
64 64
65 Console.WriteLine("[GRID CLIENT]: *** Registering region 1"); 65 Console.WriteLine("[GRID CLIENT]: *** Registering region 1");
66 bool success = m_Connector.RegisterRegion(UUID.Zero, r1); 66 string msg = m_Connector.RegisterRegion(UUID.Zero, r1);
67 if (success) 67 if (msg == String.Empty)
68 Console.WriteLine("[GRID CLIENT]: Successfully registered region 1"); 68 Console.WriteLine("[GRID CLIENT]: Successfully registered region 1");
69 else 69 else
70 Console.WriteLine("[GRID CLIENT]: region 1 failed to register"); 70 Console.WriteLine("[GRID CLIENT]: region 1 failed to register");
71 71
72 Console.WriteLine("[GRID CLIENT]: *** Registering region 2"); 72 Console.WriteLine("[GRID CLIENT]: *** Registering region 2");
73 success = m_Connector.RegisterRegion(UUID.Zero, r2); 73 msg = m_Connector.RegisterRegion(UUID.Zero, r2);
74 if (success) 74 if (msg == String.Empty)
75 Console.WriteLine("[GRID CLIENT]: Successfully registered region 2"); 75 Console.WriteLine("[GRID CLIENT]: Successfully registered region 2");
76 else 76 else
77 Console.WriteLine("[GRID CLIENT]: region 2 failed to register"); 77 Console.WriteLine("[GRID CLIENT]: region 2 failed to register");
78 78
79 Console.WriteLine("[GRID CLIENT]: *** Registering region 3"); 79 Console.WriteLine("[GRID CLIENT]: *** Registering region 3");
80 success = m_Connector.RegisterRegion(UUID.Zero, r3); 80 msg = m_Connector.RegisterRegion(UUID.Zero, r3);
81 if (success) 81 if (msg == String.Empty)
82 Console.WriteLine("[GRID CLIENT]: Successfully registered region 3"); 82 Console.WriteLine("[GRID CLIENT]: Successfully registered region 3");
83 else 83 else
84 Console.WriteLine("[GRID CLIENT]: region 3 failed to register"); 84 Console.WriteLine("[GRID CLIENT]: region 3 failed to register");
85 85
86 86
87 bool success;
87 Console.WriteLine("[GRID CLIENT]: *** Deregistering region 3"); 88 Console.WriteLine("[GRID CLIENT]: *** Deregistering region 3");
88 success = m_Connector.DeregisterRegion(r3.RegionID); 89 success = m_Connector.DeregisterRegion(r3.RegionID);
89 if (success) 90 if (success)
@@ -91,8 +92,8 @@ namespace OpenSim.Tests.Clients.GridClient
91 else 92 else
92 Console.WriteLine("[GRID CLIENT]: region 3 failed to deregister"); 93 Console.WriteLine("[GRID CLIENT]: region 3 failed to deregister");
93 Console.WriteLine("[GRID CLIENT]: *** Registering region 3 again"); 94 Console.WriteLine("[GRID CLIENT]: *** Registering region 3 again");
94 success = m_Connector.RegisterRegion(UUID.Zero, r3); 95 msg = m_Connector.RegisterRegion(UUID.Zero, r3);
95 if (success) 96 if (msg == String.Empty)
96 Console.WriteLine("[GRID CLIENT]: Successfully registered region 3"); 97 Console.WriteLine("[GRID CLIENT]: Successfully registered region 3");
97 else 98 else
98 Console.WriteLine("[GRID CLIENT]: region 3 failed to register"); 99 Console.WriteLine("[GRID CLIENT]: region 3 failed to register");