diff --git a/OpenSim/Data/IRegionData.cs b/OpenSim/Data/IRegionData.cs index d67b5fa0a6..218356a42d 100644 --- a/OpenSim/Data/IRegionData.cs +++ b/OpenSim/Data/IRegionData.cs @@ -71,8 +71,6 @@ namespace OpenSim.Data { RegionData Get(UUID regionID, UUID ScopeID); List Get(string regionName, UUID ScopeID); - - //BA MOD.... RegionData GetSpecific(string regionName, UUID ScopeID); RegionData Get(int x, int y, UUID ScopeID); diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index 12064a3b2a..9115e93cf6 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs @@ -81,15 +81,12 @@ namespace OpenSim.Data.MySQL } } - //BA MOD.... public RegionData GetSpecific(string regionName, UUID scopeID) { string command = "select * from `" + m_Realm + "` where regionName = ?regionName"; if (scopeID != UUID.Zero) command += " and ScopeID = ?scopeID"; - //command += " order by regionName"; - using (MySqlCommand cmd = new MySqlCommand(command)) { cmd.Parameters.AddWithValue("?regionName", regionName); @@ -104,27 +101,8 @@ namespace OpenSim.Data.MySQL } - public RegionData Get(int posX, int posY, UUID scopeID) + public RegionData Get(int posX, int posY, UUID scopeID) { -/* fixed size regions - string command = "select * from `"+m_Realm+"` where locX = ?posX and locY = ?posY"; - if (scopeID != UUID.Zero) - command += " and ScopeID = ?scopeID"; - - using (MySqlCommand cmd = new MySqlCommand(command)) - { - cmd.Parameters.AddWithValue("?posX", posX.ToString()); - cmd.Parameters.AddWithValue("?posY", posY.ToString()); - cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); - - List ret = RunCommand(cmd); - if (ret.Count == 0) - return null; - - return ret[0]; - } -*/ - // extend database search for maximum region size area string command = "select * from `" + m_Realm + "` where locX between ?startX and ?endX and locY between ?startY and ?endY"; if (scopeID != UUID.Zero) command += " and ScopeID = ?scopeID"; diff --git a/OpenSim/Data/Null/NullRegionData.cs b/OpenSim/Data/Null/NullRegionData.cs index a4385fe08c..fd6048028b 100644 --- a/OpenSim/Data/Null/NullRegionData.cs +++ b/OpenSim/Data/Null/NullRegionData.cs @@ -68,12 +68,34 @@ namespace OpenSim.Data.Null private delegate bool Matcher(string value); + public RegionData GetSpecific(string regionName, UUID scopeID) + { + if (m_useStaticInstance && Instance != this) + return Instance.GetSpecific(regionName, scopeID); + + string cleanName = regionName.ToLower(); + Matcher queryMatch; + queryMatch = delegate (string s) { return s.Equals(cleanName); }; + + lock (m_regionData) + { + foreach (RegionData r in m_regionData.Values) + { + // m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanName, r.RegionName.ToLower()); + if (queryMatch(r.RegionName.ToLower())) + return(r); + } + } + + return null; + } + public List Get(string regionName, UUID scopeID) { if (m_useStaticInstance && Instance != this) return Instance.Get(regionName, scopeID); -// m_log.DebugFormat("[NULL REGION DATA]: Getting region {0}, scope {1}", regionName, scopeID); + // m_log.DebugFormat("[NULL REGION DATA]: Getting region {0}, scope {1}", regionName, scopeID); string cleanName = regionName.ToLower(); @@ -166,13 +188,7 @@ namespace OpenSim.Data.Null return null; } - //BA MOD... - public RegionData GetSpecific(string regionName, UUID ScopeID) - { - return null; - } - - public List Get(int startX, int startY, int endX, int endY, UUID scopeID) + public List Get(int startX, int startY, int endX, int endY, UUID scopeID) { if (m_useStaticInstance && Instance != this) return Instance.Get(startX, startY, endX, endY, scopeID); diff --git a/OpenSim/Data/PGSQL/PGSQLRegionData.cs b/OpenSim/Data/PGSQL/PGSQLRegionData.cs index adea2e0998..a58fc8a97f 100644 --- a/OpenSim/Data/PGSQL/PGSQLRegionData.cs +++ b/OpenSim/Data/PGSQL/PGSQLRegionData.cs @@ -114,7 +114,6 @@ namespace OpenSim.Data.PGSQL } } - //BA MOD... public RegionData GetSpecific(string regionName, UUID scopeID) { 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 4afd0ac838..d220568d2f 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 return rinfo; } - public GridRegion GetRegionByNameSpecific(UUID scopeID, string regionName) - { - - return null; - } - public GridRegion GetRegionByName(UUID scopeID, string regionName) { bool inCache = false; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs index 5359e284b1..d31c7adfee 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 return rinfo; } - public GridRegion GetRegionByNameSpecific(UUID scopeID, string regionName) - { - - return null; - } - public GridRegion GetRegionByName(UUID scopeID, string name) { GridRegion rinfo = m_LocalGridService.GetRegionByName(scopeID, name); diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index 4e7ab00cec..c40bbd30f3 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs @@ -132,13 +132,8 @@ namespace OpenSim.Server.Handlers.Login //m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion); - - bool LibOMVclient = false; - if (request.Params.Count > 4 && (string)request.Params[4] == "gridproxy") - LibOMVclient = true; - LoginResponse reply = null; - reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, channel, mac, id0, remoteClient, LibOMVclient); + reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, channel, mac, id0, remoteClient); XmlRpcResponse response = new XmlRpcResponse(); response.Value = reply.ToHashtable(); @@ -221,7 +216,7 @@ namespace OpenSim.Server.Handlers.Login LoginResponse reply = null; reply = m_LocalService.Login(map["first"].AsString(), map["last"].AsString(), map["passwd"].AsString(), startLocation, scopeID, - map["version"].AsString(), map["channel"].AsString(), map["mac"].AsString(), map["id0"].AsString(), remoteClient,false); + map["version"].AsString(), map["channel"].AsString(), map["mac"].AsString(), map["id0"].AsString(), remoteClient); return reply.ToOSDMap(); } @@ -264,7 +259,7 @@ namespace OpenSim.Server.Handlers.Login (sender as WebSocketHttpServerHandler).GetRemoteIPEndpoint(); LoginResponse reply = null; reply = m_LocalService.Login(first, last, passwd, start, scope, version, - channel, mac, id0, endPoint,false); + channel, mac, id0, endPoint); sock.SendMessage(OSDParser.SerializeJsonString(reply.ToOSDMap())); } diff --git a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs index e8637188c8..ded7806af8 100644 --- a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs @@ -330,12 +330,6 @@ namespace OpenSim.Services.Connectors return rinfo; } - public GridRegion GetRegionByNameSpecific(UUID scopeID, string regionName) - { - - return null; - } - public GridRegion GetRegionByName(UUID scopeID, string regionName) { Dictionary sendData = new Dictionary(); diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 04de4d7bdf..a155a602d5 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -100,8 +100,6 @@ namespace OpenSim.Services.Connectors.SimianGrid #region IGridService - - public string RegisterRegion(UUID scopeID, GridRegion regionInfo) { IPEndPoint ext = regionInfo.ExternalEndPoint; diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index b672e8ce63..d8f372066f 100755 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -476,9 +476,9 @@ namespace OpenSim.Services.GridService public GridRegion GetRegionByName(UUID scopeID, string name) { - List rdatas = m_Database.Get(Util.EscapeForLike(name), scopeID); - if ((rdatas != null) && (rdatas.Count > 0)) - return RegionData2RegionInfo(rdatas[0]); // get the first + RegionData rdata = m_Database.GetSpecific(name, scopeID); + if (rdata != null) + return RegionData2RegionInfo(rdata); if (m_AllowHypergridMapSearch) { @@ -490,18 +490,7 @@ namespace OpenSim.Services.GridService return null; } - //BA MOD.... - public GridRegion GetRegionByNameSpecific(UUID scopeID, string name) - { - RegionData rdata = m_Database.GetSpecific(name, scopeID); - if (rdata != null) - { - return RegionData2RegionInfo(rdata); - } - return null; - } - - public List GetRegionsByName(UUID scopeID, string name, int maxNumber) + public List GetRegionsByName(UUID scopeID, string name, int maxNumber) { // m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name); @@ -510,7 +499,7 @@ namespace OpenSim.Services.GridService int count = 0; List rinfos = new List(); - if (count < maxNumber && m_AllowHypergridMapSearch && name.Contains(".")) + if (m_AllowHypergridMapSearch && name.Contains(".")) { string regionURI = ""; string regionHost = ""; @@ -538,7 +527,7 @@ namespace OpenSim.Services.GridService { if (count++ < maxNumber) rinfos.Add(RegionData2RegionInfo(rdata)); - if(rdata.RegionName == mapname) + if(mapname.Equals(rdata.RegionName,StringComparison.InvariantCultureIgnoreCase)) { haveMatch = true; if(count == maxNumber) @@ -560,7 +549,7 @@ namespace OpenSim.Services.GridService { if (count++ < maxNumber) rinfos.Add(RegionData2RegionInfo(rdata)); - if(rdata.RegionName == mapname) + if (mapname.Equals(rdata.RegionName, StringComparison.InvariantCultureIgnoreCase)) { haveMatch = true; if(count == maxNumber) @@ -588,11 +577,20 @@ namespace OpenSim.Services.GridService } else if (rdatas != null && (rdatas.Count > 0)) { -// m_log.DebugFormat("[GRID SERVICE]: Found {0} regions", rdatas.Count); + //m_log.DebugFormat("[GRID SERVICE]: Found {0} regions", rdatas.Count); foreach (RegionData rdata in rdatas) { if (count++ < maxNumber) rinfos.Add(RegionData2RegionInfo(rdata)); + if (name.Equals(rdata.RegionName, StringComparison.InvariantCultureIgnoreCase)) + { + if (count == maxNumber) + { + rinfos.RemoveAt(count - 1); + rinfos.Add(RegionData2RegionInfo(rdata)); + break; + } + } } } diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index f832d1dd2b..ead5d3c1ae 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -84,10 +84,6 @@ namespace OpenSim.Services.Interfaces /// Returns the region information if the name matched. Null otherwise. GridRegion GetRegionByName(UUID scopeID, string regionName); - - //BA MOD..... - GridRegion GetRegionByNameSpecific(UUID scopeID, string regionName); - /// /// Get information about regions starting with the provided name. /// diff --git a/OpenSim/Services/Interfaces/ILoginService.cs b/OpenSim/Services/Interfaces/ILoginService.cs index 7c44cd8b64..c37e666ea4 100644 --- a/OpenSim/Services/Interfaces/ILoginService.cs +++ b/OpenSim/Services/Interfaces/ILoginService.cs @@ -48,7 +48,7 @@ namespace OpenSim.Services.Interfaces public interface ILoginService { LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, UUID scopeID, - string clientVersion, string channel, string mac, string id0, IPEndPoint clientIP, bool LibOMVclient); + string clientVersion, string channel, string mac, string id0, IPEndPoint clientIP); Hashtable SetLevel(string firstName, string lastName, string passwd, int level, IPEndPoint clientIP); } diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 8baaccbb35..d4ec0e5c15 100755 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -285,18 +285,15 @@ namespace OpenSim.Services.LLLoginService } public LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, UUID scopeID, - string clientVersion, string channel, string mac, string id0, IPEndPoint clientIP, bool LibOMVclient) + string clientVersion, string channel, string mac, string id0, IPEndPoint clientIP) { bool success = false; UUID session = UUID.Random(); string processedMessage; - if (clientVersion.Contains("Radegast")) - LibOMVclient = false; - 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} ", - firstName, lastName, startLocation, clientVersion, channel, clientIP.Address.ToString(), mac, id0, LibOMVclient.ToString()); + firstName, lastName, startLocation, clientVersion, channel, clientIP.Address.ToString(), mac, id0); string curMac = mac.ToString(); @@ -699,7 +696,6 @@ namespace OpenSim.Services.LLLoginService where = "safe"; } } - } else { @@ -735,41 +731,32 @@ namespace OpenSim.Services.LLLoginService { if (!regionName.Contains("@")) { - List regions = m_GridService.GetRegionsByName(scopeID, regionName, 1); - if ((regions == null) || (regions != null && regions.Count == 0)) + region = m_GridService.GetRegionByName (scopeID, regionName); + if(region != null) + return region; + + m_log.InfoFormat("[LLLOGIN SERVICE]: Got Custom Login URI {0}, can't locate region {1}. Trying defaults.", startLocation, regionName); + List regions = m_GridService.GetDefaultRegions(scopeID); + if (regions != null && regions.Count > 0) { - m_log.InfoFormat("[LLLOGIN SERVICE]: Got Custom Login URI {0}, can't locate region {1}. Trying defaults.", startLocation, regionName); - regions = m_GridService.GetDefaultRegions(scopeID); - if (regions != null && regions.Count > 0) + where = "safe"; + return regions[0]; + } + else + { + m_log.Info("[LLOGIN SERVICE]: Last Region Not Found Attempting to find random region"); + region = FindAlternativeRegion(scopeID); + if (region != null) { where = "safe"; - return regions[0]; + return region; } else { - m_log.Info("[LLOGIN SERVICE]: Last Region Not Found Attempting to find random region"); - region = FindAlternativeRegion(scopeID); - if (region != null) - { - where = "safe"; - return region; - } - else - { - m_log.InfoFormat("[LLLOGIN SERVICE]: Got Custom Login URI {0}, Grid does not provide default regions and no alternative found.", startLocation); - return null; - } + m_log.InfoFormat("[LLLOGIN SERVICE]: Got Custom Login URI {0}, Grid does not provide default regions and no alternative found.", startLocation); + return null; } } - - //find a exact match - foreach(GridRegion r in regions) - { - if(string.Equals(regionName, r.RegionName, StringComparison.InvariantCultureIgnoreCase)) - return r; - } - // else, whatever - return regions[0]; } else {