aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/IRegionData.cs2
-rw-r--r--OpenSim/Data/MySQL/MySQLRegionData.cs24
-rw-r--r--OpenSim/Data/Null/NullRegionData.cs32
-rw-r--r--OpenSim/Data/PGSQL/PGSQLRegionData.cs1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs6
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs6
-rw-r--r--OpenSim/Server/Handlers/Login/LLLoginHandlers.cs11
-rw-r--r--OpenSim/Services/Connectors/Grid/GridServicesConnector.cs6
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs2
-rwxr-xr-xOpenSim/Services/GridService/GridService.cs36
-rw-r--r--OpenSim/Services/Interfaces/IGridService.cs4
-rw-r--r--OpenSim/Services/Interfaces/ILoginService.cs2
-rwxr-xr-xOpenSim/Services/LLLoginService/LLLoginService.cs53
13 files changed, 66 insertions, 119 deletions
diff --git a/OpenSim/Data/IRegionData.cs b/OpenSim/Data/IRegionData.cs
index d67b5fa..218356a 100644
--- a/OpenSim/Data/IRegionData.cs
+++ b/OpenSim/Data/IRegionData.cs
@@ -71,8 +71,6 @@ namespace OpenSim.Data
71 { 71 {
72 RegionData Get(UUID regionID, UUID ScopeID); 72 RegionData Get(UUID regionID, UUID ScopeID);
73 List<RegionData> Get(string regionName, UUID ScopeID); 73 List<RegionData> Get(string regionName, UUID ScopeID);
74
75 //BA MOD....
76 RegionData GetSpecific(string regionName, UUID ScopeID); 74 RegionData GetSpecific(string regionName, UUID ScopeID);
77 75
78 RegionData Get(int x, int y, UUID ScopeID); 76 RegionData Get(int x, int y, UUID ScopeID);
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs
index 12064a3..9115e93 100644
--- a/OpenSim/Data/MySQL/MySQLRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLRegionData.cs
@@ -81,15 +81,12 @@ namespace OpenSim.Data.MySQL
81 } 81 }
82 } 82 }
83 83
84 //BA MOD....
85 public RegionData GetSpecific(string regionName, UUID scopeID) 84 public RegionData GetSpecific(string regionName, UUID scopeID)
86 { 85 {
87 string command = "select * from `" + m_Realm + "` where regionName = ?regionName"; 86 string command = "select * from `" + m_Realm + "` where regionName = ?regionName";
88 if (scopeID != UUID.Zero) 87 if (scopeID != UUID.Zero)
89 command += " and ScopeID = ?scopeID"; 88 command += " and ScopeID = ?scopeID";
90 89
91 //command += " order by regionName";
92
93 using (MySqlCommand cmd = new MySqlCommand(command)) 90 using (MySqlCommand cmd = new MySqlCommand(command))
94 { 91 {
95 cmd.Parameters.AddWithValue("?regionName", regionName); 92 cmd.Parameters.AddWithValue("?regionName", regionName);
@@ -104,27 +101,8 @@ namespace OpenSim.Data.MySQL
104 101
105 } 102 }
106 103
107 public RegionData Get(int posX, int posY, UUID scopeID) 104 public RegionData Get(int posX, int posY, UUID scopeID)
108 { 105 {
109/* fixed size regions
110 string command = "select * from `"+m_Realm+"` where locX = ?posX and locY = ?posY";
111 if (scopeID != UUID.Zero)
112 command += " and ScopeID = ?scopeID";
113
114 using (MySqlCommand cmd = new MySqlCommand(command))
115 {
116 cmd.Parameters.AddWithValue("?posX", posX.ToString());
117 cmd.Parameters.AddWithValue("?posY", posY.ToString());
118 cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
119
120 List<RegionData> ret = RunCommand(cmd);
121 if (ret.Count == 0)
122 return null;
123
124 return ret[0];
125 }
126*/
127 // extend database search for maximum region size area
128 string command = "select * from `" + m_Realm + "` where locX between ?startX and ?endX and locY between ?startY and ?endY"; 106 string command = "select * from `" + m_Realm + "` where locX between ?startX and ?endX and locY between ?startY and ?endY";
129 if (scopeID != UUID.Zero) 107 if (scopeID != UUID.Zero)
130 command += " and ScopeID = ?scopeID"; 108 command += " and ScopeID = ?scopeID";
diff --git a/OpenSim/Data/Null/NullRegionData.cs b/OpenSim/Data/Null/NullRegionData.cs
index a4385fe..fd60480 100644
--- a/OpenSim/Data/Null/NullRegionData.cs
+++ b/OpenSim/Data/Null/NullRegionData.cs
@@ -68,12 +68,34 @@ namespace OpenSim.Data.Null
68 68
69 private delegate bool Matcher(string value); 69 private delegate bool Matcher(string value);
70 70
71 public RegionData GetSpecific(string regionName, UUID scopeID)
72 {
73 if (m_useStaticInstance && Instance != this)
74 return Instance.GetSpecific(regionName, scopeID);
75
76 string cleanName = regionName.ToLower();
77 Matcher queryMatch;
78 queryMatch = delegate (string s) { return s.Equals(cleanName); };
79
80 lock (m_regionData)
81 {
82 foreach (RegionData r in m_regionData.Values)
83 {
84 // m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanName, r.RegionName.ToLower());
85 if (queryMatch(r.RegionName.ToLower()))
86 return(r);
87 }
88 }
89
90 return null;
91 }
92
71 public List<RegionData> Get(string regionName, UUID scopeID) 93 public List<RegionData> Get(string regionName, UUID scopeID)
72 { 94 {
73 if (m_useStaticInstance && Instance != this) 95 if (m_useStaticInstance && Instance != this)
74 return Instance.Get(regionName, scopeID); 96 return Instance.Get(regionName, scopeID);
75 97
76// m_log.DebugFormat("[NULL REGION DATA]: Getting region {0}, scope {1}", regionName, scopeID); 98 // m_log.DebugFormat("[NULL REGION DATA]: Getting region {0}, scope {1}", regionName, scopeID);
77 99
78 string cleanName = regionName.ToLower(); 100 string cleanName = regionName.ToLower();
79 101
@@ -166,13 +188,7 @@ namespace OpenSim.Data.Null
166 return null; 188 return null;
167 } 189 }
168 190
169 //BA MOD... 191 public List<RegionData> Get(int startX, int startY, int endX, int endY, UUID scopeID)
170 public RegionData GetSpecific(string regionName, UUID ScopeID)
171 {
172 return null;
173 }
174
175 public List<RegionData> Get(int startX, int startY, int endX, int endY, UUID scopeID)
176 { 192 {
177 if (m_useStaticInstance && Instance != this) 193 if (m_useStaticInstance && Instance != this)
178 return Instance.Get(startX, startY, endX, endY, scopeID); 194 return Instance.Get(startX, startY, endX, endY, scopeID);
diff --git a/OpenSim/Data/PGSQL/PGSQLRegionData.cs b/OpenSim/Data/PGSQL/PGSQLRegionData.cs
index adea2e0..a58fc8a 100644
--- a/OpenSim/Data/PGSQL/PGSQLRegionData.cs
+++ b/OpenSim/Data/PGSQL/PGSQLRegionData.cs
@@ -114,7 +114,6 @@ namespace OpenSim.Data.PGSQL
114 } 114 }
115 } 115 }
116 116
117 //BA MOD...
118 public RegionData GetSpecific(string regionName, UUID scopeID) 117 public RegionData GetSpecific(string regionName, UUID scopeID)
119 { 118 {
120 string sql = "select * from " + m_Realm + " where lower(\"regionName\") = lower(:regionName) "; 119 string sql = "select * from " + m_Realm + " where lower(\"regionName\") = lower(:regionName) ";
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
index 4afd0ac..d220568 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
@@ -240,12 +240,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
240 return rinfo; 240 return rinfo;
241 } 241 }
242 242
243 public GridRegion GetRegionByNameSpecific(UUID scopeID, string regionName)
244 {
245
246 return null;
247 }
248
249 public GridRegion GetRegionByName(UUID scopeID, string regionName) 243 public GridRegion GetRegionByName(UUID scopeID, string regionName)
250 { 244 {
251 bool inCache = false; 245 bool inCache = false;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
index 5359e28..d31c7ad 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
@@ -236,12 +236,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
236 return rinfo; 236 return rinfo;
237 } 237 }
238 238
239 public GridRegion GetRegionByNameSpecific(UUID scopeID, string regionName)
240 {
241
242 return null;
243 }
244
245 public GridRegion GetRegionByName(UUID scopeID, string name) 239 public GridRegion GetRegionByName(UUID scopeID, string name)
246 { 240 {
247 GridRegion rinfo = m_LocalGridService.GetRegionByName(scopeID, name); 241 GridRegion rinfo = m_LocalGridService.GetRegionByName(scopeID, name);
diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs
index 4e7ab00..c40bbd3 100644
--- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs
+++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs
@@ -132,13 +132,8 @@ namespace OpenSim.Server.Handlers.Login
132 132
133 //m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion); 133 //m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion);
134 134
135
136 bool LibOMVclient = false;
137 if (request.Params.Count > 4 && (string)request.Params[4] == "gridproxy")
138 LibOMVclient = true;
139
140 LoginResponse reply = null; 135 LoginResponse reply = null;
141 reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, channel, mac, id0, remoteClient, LibOMVclient); 136 reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, channel, mac, id0, remoteClient);
142 137
143 XmlRpcResponse response = new XmlRpcResponse(); 138 XmlRpcResponse response = new XmlRpcResponse();
144 response.Value = reply.ToHashtable(); 139 response.Value = reply.ToHashtable();
@@ -221,7 +216,7 @@ namespace OpenSim.Server.Handlers.Login
221 216
222 LoginResponse reply = null; 217 LoginResponse reply = null;
223 reply = m_LocalService.Login(map["first"].AsString(), map["last"].AsString(), map["passwd"].AsString(), startLocation, scopeID, 218 reply = m_LocalService.Login(map["first"].AsString(), map["last"].AsString(), map["passwd"].AsString(), startLocation, scopeID,
224 map["version"].AsString(), map["channel"].AsString(), map["mac"].AsString(), map["id0"].AsString(), remoteClient,false); 219 map["version"].AsString(), map["channel"].AsString(), map["mac"].AsString(), map["id0"].AsString(), remoteClient);
225 return reply.ToOSDMap(); 220 return reply.ToOSDMap();
226 221
227 } 222 }
@@ -264,7 +259,7 @@ namespace OpenSim.Server.Handlers.Login
264 (sender as WebSocketHttpServerHandler).GetRemoteIPEndpoint(); 259 (sender as WebSocketHttpServerHandler).GetRemoteIPEndpoint();
265 LoginResponse reply = null; 260 LoginResponse reply = null;
266 reply = m_LocalService.Login(first, last, passwd, start, scope, version, 261 reply = m_LocalService.Login(first, last, passwd, start, scope, version,
267 channel, mac, id0, endPoint,false); 262 channel, mac, id0, endPoint);
268 sock.SendMessage(OSDParser.SerializeJsonString(reply.ToOSDMap())); 263 sock.SendMessage(OSDParser.SerializeJsonString(reply.ToOSDMap()));
269 264
270 } 265 }
diff --git a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs
index e863718..ded7806 100644
--- a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs
@@ -330,12 +330,6 @@ namespace OpenSim.Services.Connectors
330 return rinfo; 330 return rinfo;
331 } 331 }
332 332
333 public GridRegion GetRegionByNameSpecific(UUID scopeID, string regionName)
334 {
335
336 return null;
337 }
338
339 public GridRegion GetRegionByName(UUID scopeID, string regionName) 333 public GridRegion GetRegionByName(UUID scopeID, string regionName)
340 { 334 {
341 Dictionary<string, object> sendData = new Dictionary<string, object>(); 335 Dictionary<string, object> sendData = new Dictionary<string, object>();
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
index 04de4d7..a155a60 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
@@ -100,8 +100,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
100 100
101 #region IGridService 101 #region IGridService
102 102
103
104
105 public string RegisterRegion(UUID scopeID, GridRegion regionInfo) 103 public string RegisterRegion(UUID scopeID, GridRegion regionInfo)
106 { 104 {
107 IPEndPoint ext = regionInfo.ExternalEndPoint; 105 IPEndPoint ext = regionInfo.ExternalEndPoint;
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index b672e8c..d8f3720 100755
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -476,9 +476,9 @@ namespace OpenSim.Services.GridService
476 476
477 public GridRegion GetRegionByName(UUID scopeID, string name) 477 public GridRegion GetRegionByName(UUID scopeID, string name)
478 { 478 {
479 List<RegionData> rdatas = m_Database.Get(Util.EscapeForLike(name), scopeID); 479 RegionData rdata = m_Database.GetSpecific(name, scopeID);
480 if ((rdatas != null) && (rdatas.Count > 0)) 480 if (rdata != null)
481 return RegionData2RegionInfo(rdatas[0]); // get the first 481 return RegionData2RegionInfo(rdata);
482 482
483 if (m_AllowHypergridMapSearch) 483 if (m_AllowHypergridMapSearch)
484 { 484 {
@@ -490,18 +490,7 @@ namespace OpenSim.Services.GridService
490 return null; 490 return null;
491 } 491 }
492 492
493 //BA MOD.... 493 public List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber)
494 public GridRegion GetRegionByNameSpecific(UUID scopeID, string name)
495 {
496 RegionData rdata = m_Database.GetSpecific(name, scopeID);
497 if (rdata != null)
498 {
499 return RegionData2RegionInfo(rdata);
500 }
501 return null;
502 }
503
504 public List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber)
505 { 494 {
506// m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name); 495// m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name);
507 496
@@ -510,7 +499,7 @@ namespace OpenSim.Services.GridService
510 int count = 0; 499 int count = 0;
511 List<GridRegion> rinfos = new List<GridRegion>(); 500 List<GridRegion> rinfos = new List<GridRegion>();
512 501
513 if (count < maxNumber && m_AllowHypergridMapSearch && name.Contains(".")) 502 if (m_AllowHypergridMapSearch && name.Contains("."))
514 { 503 {
515 string regionURI = ""; 504 string regionURI = "";
516 string regionHost = ""; 505 string regionHost = "";
@@ -538,7 +527,7 @@ namespace OpenSim.Services.GridService
538 { 527 {
539 if (count++ < maxNumber) 528 if (count++ < maxNumber)
540 rinfos.Add(RegionData2RegionInfo(rdata)); 529 rinfos.Add(RegionData2RegionInfo(rdata));
541 if(rdata.RegionName == mapname) 530 if(mapname.Equals(rdata.RegionName,StringComparison.InvariantCultureIgnoreCase))
542 { 531 {
543 haveMatch = true; 532 haveMatch = true;
544 if(count == maxNumber) 533 if(count == maxNumber)
@@ -560,7 +549,7 @@ namespace OpenSim.Services.GridService
560 { 549 {
561 if (count++ < maxNumber) 550 if (count++ < maxNumber)
562 rinfos.Add(RegionData2RegionInfo(rdata)); 551 rinfos.Add(RegionData2RegionInfo(rdata));
563 if(rdata.RegionName == mapname) 552 if (mapname.Equals(rdata.RegionName, StringComparison.InvariantCultureIgnoreCase))
564 { 553 {
565 haveMatch = true; 554 haveMatch = true;
566 if(count == maxNumber) 555 if(count == maxNumber)
@@ -588,11 +577,20 @@ namespace OpenSim.Services.GridService
588 } 577 }
589 else if (rdatas != null && (rdatas.Count > 0)) 578 else if (rdatas != null && (rdatas.Count > 0))
590 { 579 {
591// m_log.DebugFormat("[GRID SERVICE]: Found {0} regions", rdatas.Count); 580 //m_log.DebugFormat("[GRID SERVICE]: Found {0} regions", rdatas.Count);
592 foreach (RegionData rdata in rdatas) 581 foreach (RegionData rdata in rdatas)
593 { 582 {
594 if (count++ < maxNumber) 583 if (count++ < maxNumber)
595 rinfos.Add(RegionData2RegionInfo(rdata)); 584 rinfos.Add(RegionData2RegionInfo(rdata));
585 if (name.Equals(rdata.RegionName, StringComparison.InvariantCultureIgnoreCase))
586 {
587 if (count == maxNumber)
588 {
589 rinfos.RemoveAt(count - 1);
590 rinfos.Add(RegionData2RegionInfo(rdata));
591 break;
592 }
593 }
596 } 594 }
597 } 595 }
598 596
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs
index f832d1d..ead5d3c 100644
--- a/OpenSim/Services/Interfaces/IGridService.cs
+++ b/OpenSim/Services/Interfaces/IGridService.cs
@@ -84,10 +84,6 @@ namespace OpenSim.Services.Interfaces
84 /// <returns>Returns the region information if the name matched. Null otherwise.</returns> 84 /// <returns>Returns the region information if the name matched. Null otherwise.</returns>
85 GridRegion GetRegionByName(UUID scopeID, string regionName); 85 GridRegion GetRegionByName(UUID scopeID, string regionName);
86 86
87
88 //BA MOD.....
89 GridRegion GetRegionByNameSpecific(UUID scopeID, string regionName);
90
91 /// <summary> 87 /// <summary>
92 /// Get information about regions starting with the provided name. 88 /// Get information about regions starting with the provided name.
93 /// </summary> 89 /// </summary>
diff --git a/OpenSim/Services/Interfaces/ILoginService.cs b/OpenSim/Services/Interfaces/ILoginService.cs
index 7c44cd8..c37e666 100644
--- a/OpenSim/Services/Interfaces/ILoginService.cs
+++ b/OpenSim/Services/Interfaces/ILoginService.cs
@@ -48,7 +48,7 @@ namespace OpenSim.Services.Interfaces
48 public interface ILoginService 48 public interface ILoginService
49 { 49 {
50 LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, UUID scopeID, 50 LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, UUID scopeID,
51 string clientVersion, string channel, string mac, string id0, IPEndPoint clientIP, bool LibOMVclient); 51 string clientVersion, string channel, string mac, string id0, IPEndPoint clientIP);
52 Hashtable SetLevel(string firstName, string lastName, string passwd, int level, IPEndPoint clientIP); 52 Hashtable SetLevel(string firstName, string lastName, string passwd, int level, IPEndPoint clientIP);
53 } 53 }
54 54
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 8baaccb..d4ec0e5 100755
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -285,18 +285,15 @@ namespace OpenSim.Services.LLLoginService
285 } 285 }
286 286
287 public LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, UUID scopeID, 287 public LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, UUID scopeID,
288 string clientVersion, string channel, string mac, string id0, IPEndPoint clientIP, bool LibOMVclient) 288 string clientVersion, string channel, string mac, string id0, IPEndPoint clientIP)
289 { 289 {
290 bool success = false; 290 bool success = false;
291 UUID session = UUID.Random(); 291 UUID session = UUID.Random();
292 292
293 string processedMessage; 293 string processedMessage;
294 294
295 if (clientVersion.Contains("Radegast"))
296 LibOMVclient = false;
297
298 m_log.InfoFormat("[LLOGIN SERVICE]: Login request for {0} {1} at {2} using viewer {3}, channel {4}, IP {5}, Mac {6}, Id0 {7}, Possible LibOMVGridProxy: {8} ", 295 m_log.InfoFormat("[LLOGIN SERVICE]: Login request for {0} {1} at {2} using viewer {3}, channel {4}, IP {5}, Mac {6}, Id0 {7}, Possible LibOMVGridProxy: {8} ",
299 firstName, lastName, startLocation, clientVersion, channel, clientIP.Address.ToString(), mac, id0, LibOMVclient.ToString()); 296 firstName, lastName, startLocation, clientVersion, channel, clientIP.Address.ToString(), mac, id0);
300 297
301 string curMac = mac.ToString(); 298 string curMac = mac.ToString();
302 299
@@ -699,7 +696,6 @@ namespace OpenSim.Services.LLLoginService
699 where = "safe"; 696 where = "safe";
700 } 697 }
701 } 698 }
702
703 } 699 }
704 else 700 else
705 { 701 {
@@ -735,41 +731,32 @@ namespace OpenSim.Services.LLLoginService
735 { 731 {
736 if (!regionName.Contains("@")) 732 if (!regionName.Contains("@"))
737 { 733 {
738 List<GridRegion> regions = m_GridService.GetRegionsByName(scopeID, regionName, 1); 734 region = m_GridService.GetRegionByName (scopeID, regionName);
739 if ((regions == null) || (regions != null && regions.Count == 0)) 735 if(region != null)
736 return region;
737
738 m_log.InfoFormat("[LLLOGIN SERVICE]: Got Custom Login URI {0}, can't locate region {1}. Trying defaults.", startLocation, regionName);
739 List<GridRegion> regions = m_GridService.GetDefaultRegions(scopeID);
740 if (regions != null && regions.Count > 0)
740 { 741 {
741 m_log.InfoFormat("[LLLOGIN SERVICE]: Got Custom Login URI {0}, can't locate region {1}. Trying defaults.", startLocation, regionName); 742 where = "safe";
742 regions = m_GridService.GetDefaultRegions(scopeID); 743 return regions[0];
743 if (regions != null && regions.Count > 0) 744 }
745 else
746 {
747 m_log.Info("[LLOGIN SERVICE]: Last Region Not Found Attempting to find random region");
748 region = FindAlternativeRegion(scopeID);
749 if (region != null)
744 { 750 {
745 where = "safe"; 751 where = "safe";
746 return regions[0]; 752 return region;
747 } 753 }
748 else 754 else
749 { 755 {
750 m_log.Info("[LLOGIN SERVICE]: Last Region Not Found Attempting to find random region"); 756 m_log.InfoFormat("[LLLOGIN SERVICE]: Got Custom Login URI {0}, Grid does not provide default regions and no alternative found.", startLocation);
751 region = FindAlternativeRegion(scopeID); 757 return null;
752 if (region != null)
753 {
754 where = "safe";
755 return region;
756 }
757 else
758 {
759 m_log.InfoFormat("[LLLOGIN SERVICE]: Got Custom Login URI {0}, Grid does not provide default regions and no alternative found.", startLocation);
760 return null;
761 }
762 } 758 }
763 } 759 }
764
765 //find a exact match
766 foreach(GridRegion r in regions)
767 {
768 if(string.Equals(regionName, r.RegionName, StringComparison.InvariantCultureIgnoreCase))
769 return r;
770 }
771 // else, whatever
772 return regions[0];
773 } 760 }
774 else 761 else
775 { 762 {