diff --git a/OpenSim/Framework/Communications/LoginResponse.cs b/OpenSim/Framework/Communications/LoginResponse.cs index a815662f26..4a319867bd 100644 --- a/OpenSim/Framework/Communications/LoginResponse.cs +++ b/OpenSim/Framework/Communications/LoginResponse.cs @@ -170,7 +170,6 @@ namespace OpenSim.Framework.UserManagement AddClassifiedCategory((Int32) 8, "Service"); AddClassifiedCategory((Int32) 9, "Personal"); - SessionID = LLUUID.Random(); SecureSessionID = LLUUID.Random(); AgentID = LLUUID.Random(); @@ -244,7 +243,10 @@ namespace OpenSim.Framework.UserManagement { return (GenerateFailureResponse("presence", - "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner. Please wait 5 minutes if you are going to connect to a region nearby to the region you were at previously.", + "You appear to be already logged in. " + + "If this is not the case please wait for your session to timeout. " + + "If this takes longer than a few minutes please contact the grid owner. " + + "Please wait 5 minutes if you are going to connect to a region nearby to the region you were at previously.", "false")); } @@ -252,7 +254,9 @@ namespace OpenSim.Framework.UserManagement { return GenerateFailureResponseLLSD( "presence", - "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner", + "You appear to be already logged in. " + + "If this is not the case please wait for your session to timeout. " + + "If this takes longer than a few minutes please contact the grid owner", "false"); } diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs index 72b408b056..be47258d23 100644 --- a/OpenSim/Framework/Communications/LoginService.cs +++ b/OpenSim/Framework/Communications/LoginService.cs @@ -121,6 +121,7 @@ namespace OpenSim.Framework.UserManagement return logResponse.CreateLoginFailedResponse(); } + if (requestData.Contains("passwd")) { string passwd = (string)requestData["passwd"]; @@ -494,8 +495,8 @@ namespace OpenSim.Framework.UserManagement } public string GetLoginForm(string firstname, string lastname, string location, string region, - string grid, string channel, string version, string lang, - string password, string errormessages) + string grid, string channel, string version, string lang, + string password, string errormessages) { // inject our values in the form at the markers @@ -522,6 +523,7 @@ namespace OpenSim.Framework.UserManagement loginform = loginform.Replace("[$lang]", lang); loginform = loginform.Replace("[$password]", password); loginform = loginform.Replace("[$errors]", errormessages); + return loginform; } @@ -588,6 +590,7 @@ namespace OpenSim.Framework.UserManagement responseString += ""; responseString += ""; responseString += ""; + return responseString; } diff --git a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs index 999d4f88ea..9320ef98a3 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs @@ -103,6 +103,7 @@ namespace OpenSim.Framework.Data.DB4o throw new Exception("GetProfileByString Not supported in DB4oGridData"); //return null; } + /// /// Adds a new specified region to the database /// diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs index 38a1d08929..5a0f3f5aa1 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs @@ -180,7 +180,6 @@ namespace OpenSim.Framework.Data.MSSQL return row; } - /// /// Returns a sim profile from it's Region name string /// @@ -222,7 +221,6 @@ namespace OpenSim.Framework.Data.MSSQL } } - /// /// Adds a new specified region to the database /// @@ -242,7 +240,7 @@ namespace OpenSim.Framework.Data.MSSQL System.Console.WriteLine("No regions found. Create new one."); } - if ( insertRegionRow(profile)) + if (insertRegionRow(profile)) { return DataResponse.RESPONSE_OK; } @@ -252,7 +250,6 @@ namespace OpenSim.Framework.Data.MSSQL } } - /// /// Creates a new region in the database /// @@ -324,7 +321,7 @@ namespace OpenSim.Framework.Data.MSSQL } /// - /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. + /// DEPRECATED. Attempts to authenticate a region by comparing a shared secret. /// /// The UUID of the challenger /// The attempted regionHandle of the challenger diff --git a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs index 3855d99ee5..0cba9f0bfe 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs @@ -331,7 +331,7 @@ namespace OpenSim.Framework.Data.MySQL } /// - /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. + /// DEPRECATED. Attempts to authenticate a region by comparing a shared secret. /// /// The UUID of the challenger /// The attempted regionHandle of the challenger diff --git a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs index 4d42f19b6e..397ef82e3d 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs @@ -114,13 +114,12 @@ namespace OpenSim.Framework.Data.SQLite /// /// Returns a sim profile from it's Region name string /// - /// The region name search query + /// The region name search query /// The sim profile public RegionProfileData GetProfileByString(string regionName) { if (regionName.Length > 2) { - Dictionary param = new Dictionary(); // Add % because this is a like query. param["?regionName"] = regionName + "%"; @@ -133,7 +132,6 @@ namespace OpenSim.Framework.Data.SQLite result.Dispose(); return row; - } else { @@ -142,7 +140,6 @@ namespace OpenSim.Framework.Data.SQLite } } - /// /// Returns a sim profile from it's UUID /// @@ -191,7 +188,7 @@ namespace OpenSim.Framework.Data.SQLite } /// - /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. + /// DEPRECATED. Attempts to authenticate a region by comparing a shared secret. /// /// The UUID of the challenger /// The attempted regionHandle of the challenger diff --git a/OpenSim/Framework/Data/RegionProfileData.cs b/OpenSim/Framework/Data/RegionProfileData.cs index f736571c98..84713b4fe7 100644 --- a/OpenSim/Framework/Data/RegionProfileData.cs +++ b/OpenSim/Framework/Data/RegionProfileData.cs @@ -56,7 +56,6 @@ namespace OpenSim.Framework.Data /// Coordinates of the region /// public uint regionLocX; - public uint regionLocY; public uint regionLocZ; // Reserved (round-robin, layers, etc) @@ -65,7 +64,6 @@ namespace OpenSim.Framework.Data /// /// Not very secure, needs improvement. public string regionSendKey = String.Empty; - public string regionRecvKey = String.Empty; public string regionSecret = String.Empty; @@ -78,7 +76,6 @@ namespace OpenSim.Framework.Data /// Information about the server that the region is currently hosted on /// public string serverIP = String.Empty; - public uint serverPort; public string serverURI = String.Empty; @@ -90,7 +87,6 @@ namespace OpenSim.Framework.Data /// Set of optional overrides. Can be used to create non-eulicidean spaces. /// public ulong regionNorthOverrideHandle; - public ulong regionSouthOverrideHandle; public ulong regionEastOverrideHandle; public ulong regionWestOverrideHandle; @@ -133,7 +129,6 @@ namespace OpenSim.Framework.Data /// public LLUUID originUUID; - /// /// Get Sim profile data from grid server when in grid mode /// @@ -184,7 +179,7 @@ namespace OpenSim.Framework.Data /// /// The sim profile. Null if there was a request failure public static RegionProfileData RequestSimProfileData(ulong region_handle, string gridserver_url, - string gridserver_sendkey, string gridserver_recvkey) + string gridserver_sendkey, string gridserver_recvkey) { Hashtable requestData = new Hashtable(); requestData["region_handle"] = region_handle.ToString(); @@ -226,7 +221,7 @@ namespace OpenSim.Framework.Data /// /// The sim profile. Null if there was a request failure public static RegionProfileData RequestSimProfileData(string regionName, string gridserver_url, - string gridserver_sendkey, string gridserver_recvkey) + string gridserver_sendkey, string gridserver_recvkey) { Hashtable requestData = new Hashtable(); requestData["region_name_search"] = regionName; diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 37ddb3e74c..e16d15e29c 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -52,7 +52,6 @@ namespace OpenSim.Framework // Get a list of invalid file characters (OS dependent) private static string regexInvalidFileChars = "[" + new String(Path.GetInvalidFileNameChars()) + "]"; - #region Vector Equasions /// /// Get the distance between two 3d vectors @@ -106,6 +105,7 @@ namespace OpenSim.Framework return false; } + # endregion public static ulong UIntsToLong(uint X, uint Y) @@ -384,8 +384,6 @@ namespace OpenSim.Framework return System.Text.RegularExpressions.Regex.Replace(filename, @regexInvalidFileChars, string.Empty); ; } - - // // directory locations // @@ -411,23 +409,17 @@ namespace OpenSim.Framework public static string configDir() { - string temp; - temp = "."; - return temp; + return "."; } public static string dataDir() { - string temp; - temp = "."; - return temp; + return "."; } public static string logDir() { - string temp; - temp = "."; - return temp; + return "."; } public static string GetCapsURL(LLUUID userID) @@ -549,8 +541,8 @@ namespace OpenSim.Framework try { stream = new FileStream( - filename, FileMode.Create, - FileAccess.Write, FileShare.None); + filename, FileMode.Create, + FileAccess.Write, FileShare.None); formatter.Serialize(stream, obj); } @@ -577,8 +569,8 @@ namespace OpenSim.Framework try { stream = new FileStream( - filename, FileMode.Open, - FileAccess.Read, FileShare.None); + filename, FileMode.Open, + FileAccess.Read, FileShare.None); ret = formatter.Deserialize(stream); } @@ -597,6 +589,7 @@ namespace OpenSim.Framework return ret; } + public static string[] ParseStartLocationRequest(string startLocationRequest) { string[] returnstring = new string[4]; @@ -617,33 +610,22 @@ namespace OpenSim.Framework if (splitstr.GetLength(0) == 2) { - string[] splitstr2 = splitstr[1].Split('&');//, 4, StringSplitOptions.RemoveEmptyEntries); //System.Console.WriteLine("Found " + splitstr2.GetLength(0) + " elements in 2nd split result"); - if (splitstr2.GetLength(0) >= 1) + int len = Math.Min(splitstr2.GetLength(0), 4); + + for (int i = 0; i < 4; ++i) { - returnstring[0] = splitstr2[0]; - } - if (splitstr2.GetLength(0) >= 2) - { - returnstring[1] = splitstr2[1]; - } - if (splitstr2.GetLength(0) >= 3) - { - returnstring[2] = splitstr2[2]; - } - if (splitstr2.GetLength(0) >= 4) - { - returnstring[3] = splitstr2[3]; + if (len > i) + { + returnstring[i] = splitstr2[i]; + } } } - } return returnstring; - - } } } diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs index 86fc4456dc..56f294c6e9 100644 --- a/OpenSim/Grid/GridServer/GridManager.cs +++ b/OpenSim/Grid/GridServer/GridManager.cs @@ -219,6 +219,7 @@ namespace OpenSim.Grid.GridServer RegionProfileData central_region = getRegion(reqhandle); RegionProfileData neighbour; for (int x = -1; x < 2; x++) + { for (int y = -1; y < 2; y++) { if ( @@ -230,6 +231,7 @@ namespace OpenSim.Grid.GridServer getRegion( Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize), (uint)(central_region.regionLocY + y) * Constants.RegionSize)); + response += ""; response += "" + neighbour.serverIP + ""; response += "" + neighbour.serverPort.ToString() + ""; @@ -239,23 +241,20 @@ namespace OpenSim.Grid.GridServer response += ""; } } + } return response; } protected virtual bool ValidateOverwrite(RegionProfileData sim, RegionProfileData existingSim) { - bool validated; - validated = (existingSim.regionRecvKey == sim.regionRecvKey && - existingSim.regionSendKey == sim.regionSendKey); - return validated; + return (existingSim.regionRecvKey == sim.regionRecvKey && + existingSim.regionSendKey == sim.regionSendKey); } protected virtual bool ValidateNewRegion(RegionProfileData sim) { - bool validated; - validated = (sim.regionRecvKey == Config.SimSendKey && - sim.regionSendKey == Config.SimRecvKey); - return validated; + return (sim.regionRecvKey == Config.SimSendKey && + sim.regionSendKey == Config.SimRecvKey); } private XmlRpcResponse ErrorResponse(string error) @@ -274,17 +273,13 @@ namespace OpenSim.Grid.GridServer /// Startup parameters public XmlRpcResponse XmlRpcSimulatorLoginMethod(XmlRpcRequest request) { - RegionProfileData sim; RegionProfileData existingSim; Hashtable requestData = (Hashtable)request.Params[0]; LLUUID uuid; - if (requestData.ContainsKey("UUID") && LLUUID.TryParse((string)requestData["UUID"], out uuid)) - { - } - else + if (!requestData.ContainsKey("UUID") || !LLUUID.TryParse((string)requestData["UUID"], out uuid)) { m_log.Info("[GRID]: Region connected without a UUID, ignoring."); return ErrorResponse("No UUID passed to grid server - unable to connect you"); @@ -459,6 +454,7 @@ namespace OpenSim.Grid.GridServer else { for (int x = -1; x < 2; x++) + { for (int y = -1; y < 2; y++) { if ( @@ -482,6 +478,7 @@ namespace OpenSim.Grid.GridServer if (neighbour.UUID != sim.UUID) SimNeighboursData.Add(NeighbourBlock); } } + } } return SimNeighboursData; } @@ -505,7 +502,6 @@ namespace OpenSim.Grid.GridServer sim.regionUserSendKey = Config.UserSendKey; sim.regionUserRecvKey = Config.UserRecvKey; - sim.serverIP = (string)requestData["sim_ip"]; sim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]); sim.httpPort = Convert.ToUInt32((string)requestData["http_port"]); @@ -514,7 +510,6 @@ namespace OpenSim.Grid.GridServer sim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]); sim.regionLocZ = 0; - LLUUID textureID; if (LLUUID.TryParse((string)requestData["map-image-id"], out textureID)) { @@ -650,7 +645,7 @@ namespace OpenSim.Grid.GridServer else { m_log.Info("[DATA]: found " + (string)simData.regionName + " regionHandle = " + - (string)requestData["region_handle"]); + (string)requestData["region_handle"]); responseData["sim_ip"] = Util.GetHostFromDNS(simData.serverIP).ToString(); responseData["sim_port"] = simData.serverPort.ToString(); responseData["server_uri"] = simData.serverURI; @@ -730,7 +725,7 @@ namespace OpenSim.Grid.GridServer simProfileList.Add(simProfileBlock); } m_log.Info("[MAP]: Fast map " + simProfileList.Count.ToString() + - " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); + " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); } else { @@ -765,7 +760,7 @@ namespace OpenSim.Grid.GridServer } } m_log.Info("[MAP]: Std map " + simProfileList.Count.ToString() + - " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); + " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); } responseData["sim-profiles"] = simProfileList; @@ -852,14 +847,14 @@ namespace OpenSim.Grid.GridServer public string RestSetSimMethod(string request, string path, string param) { Console.WriteLine("Processing region update via REST method"); - RegionProfileData TheSim; - TheSim = getRegion(new LLUUID(param)); - if ((TheSim) == null) + RegionProfileData theSim; + theSim = getRegion(new LLUUID(param)); + if (theSim == null) { - TheSim = new RegionProfileData(); + theSim = new RegionProfileData(); LLUUID UUID = new LLUUID(param); - TheSim.UUID = UUID; - TheSim.regionRecvKey = Config.SimRecvKey; + theSim.UUID = UUID; + theSim.regionRecvKey = Config.SimRecvKey; } XmlDocument doc = new XmlDocument(); @@ -877,59 +872,59 @@ namespace OpenSim.Grid.GridServer return "ERROR! bad XML - expected sim tag"; } - //TheSim.regionSendKey = Cfg; - TheSim.regionRecvKey = Config.SimRecvKey; - TheSim.regionSendKey = Config.SimSendKey; - TheSim.regionSecret = Config.SimRecvKey; - TheSim.regionDataURI = String.Empty; - TheSim.regionAssetURI = Config.DefaultAssetServer; - TheSim.regionAssetRecvKey = Config.AssetRecvKey; - TheSim.regionAssetSendKey = Config.AssetSendKey; - TheSim.regionUserURI = Config.DefaultUserServer; - TheSim.regionUserSendKey = Config.UserSendKey; - TheSim.regionUserRecvKey = Config.UserRecvKey; + //theSim.regionSendKey = Cfg; + theSim.regionRecvKey = Config.SimRecvKey; + theSim.regionSendKey = Config.SimSendKey; + theSim.regionSecret = Config.SimRecvKey; + theSim.regionDataURI = String.Empty; + theSim.regionAssetURI = Config.DefaultAssetServer; + theSim.regionAssetRecvKey = Config.AssetRecvKey; + theSim.regionAssetSendKey = Config.AssetSendKey; + theSim.regionUserURI = Config.DefaultUserServer; + theSim.regionUserSendKey = Config.UserSendKey; + theSim.regionUserRecvKey = Config.UserRecvKey; for (int i = 0; i < simnode.ChildNodes.Count; i++) { switch (simnode.ChildNodes[i].Name) { case "regionname": - TheSim.regionName = simnode.ChildNodes[i].InnerText; + theSim.regionName = simnode.ChildNodes[i].InnerText; break; case "sim_ip": - TheSim.serverIP = simnode.ChildNodes[i].InnerText; + theSim.serverIP = simnode.ChildNodes[i].InnerText; break; case "sim_port": - TheSim.serverPort = Convert.ToUInt32(simnode.ChildNodes[i].InnerText); + theSim.serverPort = Convert.ToUInt32(simnode.ChildNodes[i].InnerText); break; case "region_locx": - TheSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); - TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * Constants.RegionSize), (TheSim.regionLocY * Constants.RegionSize)); + theSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); + theSim.regionHandle = Helpers.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize)); break; case "region_locy": - TheSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); - TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * Constants.RegionSize), (TheSim.regionLocY * Constants.RegionSize)); + theSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); + theSim.regionHandle = Helpers.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize)); break; } } - TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/"; + theSim.serverURI = "http://" + theSim.serverIP + ":" + theSim.serverPort + "/"; bool requirePublic = false; bool requireValid = true; if (requirePublic && - (TheSim.serverIP.StartsWith("172.16") || TheSim.serverIP.StartsWith("192.168") || - TheSim.serverIP.StartsWith("10.") || TheSim.serverIP.StartsWith("0.") || - TheSim.serverIP.StartsWith("255."))) + (theSim.serverIP.StartsWith("172.16") || theSim.serverIP.StartsWith("192.168") || + theSim.serverIP.StartsWith("10.") || theSim.serverIP.StartsWith("0.") || + theSim.serverIP.StartsWith("255."))) { return "ERROR! Servers must register with public addresses."; } - if (requireValid && (TheSim.serverIP.StartsWith("0.") || TheSim.serverIP.StartsWith("255."))) + if (requireValid && (theSim.serverIP.StartsWith("0.") || theSim.serverIP.StartsWith("255."))) { return "ERROR! 0.*.*.* / 255.*.*.* Addresses are invalid, please check your server config and try again"; } @@ -937,27 +932,28 @@ namespace OpenSim.Grid.GridServer try { m_log.Info("[DATA]: " + - "Updating / adding via " + _plugins.Count + " storage provider(s) registered."); + "Updating / adding via " + _plugins.Count + " storage provider(s) registered."); + foreach (KeyValuePair kvp in _plugins) { try { //Check reservations ReservationData reserveData = - kvp.Value.GetReservationAtPoint(TheSim.regionLocX, TheSim.regionLocY); - if ((reserveData != null && reserveData.gridRecvKey == TheSim.regionRecvKey) || - (reserveData == null && authkeynode.InnerText != TheSim.regionRecvKey)) + kvp.Value.GetReservationAtPoint(theSim.regionLocX, theSim.regionLocY); + if ((reserveData != null && reserveData.gridRecvKey == theSim.regionRecvKey) || + (reserveData == null && authkeynode.InnerText != theSim.regionRecvKey)) { - kvp.Value.AddProfile(TheSim); - m_log.Info("[grid]: New sim added to grid (" + TheSim.regionName + ")"); - logToDB(TheSim.UUID.ToString(), "RestSetSimMethod", String.Empty, 5, + kvp.Value.AddProfile(theSim); + m_log.Info("[grid]: New sim added to grid (" + theSim.regionName + ")"); + logToDB(theSim.UUID.ToString(), "RestSetSimMethod", String.Empty, 5, "Region successfully updated and connected to grid."); } else { m_log.Warn("[grid]: " + - "Unable to update region (RestSetSimMethod): Incorrect reservation auth key."); - // Wanted: " + reserveData.gridRecvKey + ", Got: " + TheSim.regionRecvKey + "."); + "Unable to update region (RestSetSimMethod): Incorrect reservation auth key."); + // Wanted: " + reserveData.gridRecvKey + ", Got: " + theSim.regionRecvKey + "."); return "Unable to update region (RestSetSimMethod): Incorrect auth key."; } } diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs index 6cc34d565b..823733f47c 100644 --- a/OpenSim/Grid/UserServer/UserLoginService.cs +++ b/OpenSim/Grid/UserServer/UserLoginService.cs @@ -64,8 +64,6 @@ namespace OpenSim.Grid.UserServer m_config = config; } - - /// /// Customises the login response and fills in missing values. /// @@ -93,7 +91,6 @@ namespace OpenSim.Grid.UserServer RegionProfileData.RequestSimProfileData( theUser.homeRegion, m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); - } else { @@ -123,7 +120,6 @@ namespace OpenSim.Grid.UserServer theUser.homeRegion, m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); } - } } @@ -178,7 +174,6 @@ namespace OpenSim.Grid.UserServer // Update agent with target sim - m_log.Info("[LOGIN]: Telling " + SimInfo.regionName + " @ " + SimInfo.httpServerURI + " " + SimInfo.regionLocX + "," + SimInfo.regionLocY + " to expect user connection"); diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs index 8cc13124d0..de891a209e 100644 --- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs +++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs @@ -212,6 +212,7 @@ namespace OpenSim.Region.Communications.Local } return mapBlocks; } + public bool TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID) { if (m_regionListeners.ContainsKey(regionHandle)) @@ -245,7 +246,7 @@ namespace OpenSim.Region.Communications.Local return false; } - // This function Is only here to keep this class in line with the Grid Interface. + // This function is only here to keep this class in line with the Grid Interface. // It never gets called. public virtual Dictionary GetGridSettings() { @@ -291,14 +292,15 @@ namespace OpenSim.Region.Communications.Local } return false; } - /// + + /// + /// /// /// /// /// - /// public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) - //should change from agentCircuitData + // TODO: should change from agentCircuitData { //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent"); //m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: Trying to inform region of child agent: " + agentData.firstname + " " + agentData.lastname); @@ -352,8 +354,6 @@ namespace OpenSim.Region.Communications.Local return false; } - - public bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId) { if (m_regionListeners.ContainsKey(regionHandle)) diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs index eff597e960..dca8e6545e 100644 --- a/OpenSim/Region/Communications/Local/LocalLoginService.cs +++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs @@ -68,7 +68,6 @@ namespace OpenSim.Region.Communications.Local authUsers = authenticate; } - public override UserProfileData GetTheUser(string firstname, string lastname) { UserProfileData profile = m_userManager.GetUserProfile(firstname, lastname); @@ -189,6 +188,7 @@ namespace OpenSim.Region.Communications.Local m_log.Warn("[LOGIN]: Not found region " + currentRegion); } } + private LoginResponse.BuddyList ConvertFriendListItem(List LFL) { LoginResponse.BuddyList buddylistreturn = new LoginResponse.BuddyList(); @@ -199,10 +199,10 @@ namespace OpenSim.Region.Communications.Local buddyitem.BuddyRightsHave = (int)fl.FriendListOwnerPerms; buddyitem.BuddyRightsGiven = (int)fl.FriendPerms; buddylistreturn.AddNewBuddy(buddyitem); - } return buddylistreturn; } + protected override InventoryData CreateInventoryData(LLUUID userID) { List folders = m_Parent.InventoryService.RequestFirstLevelFolders(userID); diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index b7fae65223..f3248868d1 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -134,7 +134,8 @@ namespace OpenSim.Region.Communications.OGS1 { GridReq = new XmlRpcRequest("simulator_login", SendParams); GridResp = GridReq.Send(serversInfo.GridURL, 16000); - } catch (Exception ex) + } + catch (Exception ex) { m_log.Error("Unable to connect to grid. Grid server not running?"); throw(ex); @@ -182,7 +183,8 @@ namespace OpenSim.Region.Communications.OGS1 Hashtable griddatahash = GridRespData; // Process Response - if (GridRespData.ContainsKey("error")) { + if (GridRespData.ContainsKey("error")) + { string errorstring = (string)GridRespData["error"]; m_log.Error("Unable to connect to grid: " + errorstring); return false; @@ -202,7 +204,6 @@ namespace OpenSim.Region.Communications.OGS1 returnGridSettings.Add(Dictkey, m_queuedGridSettings[Dictkey]); } - m_queuedGridSettings.Clear(); } @@ -308,10 +309,7 @@ namespace OpenSim.Region.Communications.OGS1 return regionInfo; } - if (m_remoteRegionInfoCache.TryGetValue(regionHandle, out regionInfo)) - { - } - else + if (!m_remoteRegionInfoCache.TryGetValue(regionHandle, out regionInfo)) { try { @@ -366,54 +364,51 @@ namespace OpenSim.Region.Communications.OGS1 // Don't use this method. It's only for SLURLS and Logins RegionInfo regionInfo = null; try + { + Hashtable requestData = new Hashtable(); + requestData["region_name_search"] = regionName; + requestData["authkey"] = serversInfo.GridSendKey; + ArrayList SendParams = new ArrayList(); + SendParams.Add(requestData); + XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); + XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000); + + Hashtable responseData = (Hashtable) GridResp.Value; + + if (responseData.ContainsKey("error")) { - Hashtable requestData = new Hashtable(); - requestData["region_name_search"] = regionName; - requestData["authkey"] = serversInfo.GridSendKey; - ArrayList SendParams = new ArrayList(); - SendParams.Add(requestData); - XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); - XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000); - - Hashtable responseData = (Hashtable) GridResp.Value; - - if (responseData.ContainsKey("error")) - { - m_log.Error("[OGS1 GRID SERVICES]: Error received from grid server" + responseData["error"]); - return null; - } - - uint regX = Convert.ToUInt32((string) responseData["region_locx"]); - uint regY = Convert.ToUInt32((string) responseData["region_locy"]); - string internalIpStr = (string) responseData["sim_ip"]; - uint port = Convert.ToUInt32(responseData["sim_port"]); - string externalUri = (string) responseData["sim_uri"]; - - IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port); - string neighbourExternalUri = externalUri; - regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr); - - regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); - regionInfo.RemotingAddress = internalIpStr; - - regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]); - regionInfo.RegionName = (string) responseData["region_name"]; - - m_remoteRegionInfoCache.Add(regionInfo.RegionHandle, regionInfo); + m_log.Error("[OGS1 GRID SERVICES]: Error received from grid server" + responseData["error"]); + return null; } - catch (WebException) - { - m_log.Error("[OGS1 GRID SERVICES]: " + - "Region lookup failed for: " + regionName + - " - Is the GridServer down?"); - } - + + uint regX = Convert.ToUInt32((string) responseData["region_locx"]); + uint regY = Convert.ToUInt32((string) responseData["region_locy"]); + string internalIpStr = (string) responseData["sim_ip"]; + uint port = Convert.ToUInt32(responseData["sim_port"]); + string externalUri = (string) responseData["sim_uri"]; + + IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port); + string neighbourExternalUri = externalUri; + regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr); + + regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); + regionInfo.RemotingAddress = internalIpStr; + + regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]); + regionInfo.RegionName = (string) responseData["region_name"]; + + m_remoteRegionInfoCache.Add(regionInfo.RegionHandle, regionInfo); + } + catch (WebException) + { + m_log.Error("[OGS1 GRID SERVICES]: " + + "Region lookup failed for: " + regionName + + " - Is the GridServer down?"); + } return regionInfo; - } - /// /// /// @@ -465,9 +460,6 @@ namespace OpenSim.Region.Communications.OGS1 return neighbours; } - - - /// /// Performs a XML-RPC query against the grid server returning mapblock information in the specified coordinates /// @@ -519,7 +511,6 @@ namespace OpenSim.Region.Communications.OGS1 return response; } - // Grid Request Processing /// /// Received from the user server when a user starts logging in. This call allows @@ -596,7 +587,6 @@ namespace OpenSim.Region.Communications.OGS1 InterRegionSingleton.Instance.OnRegionUp += TriggerRegionUp; InterRegionSingleton.Instance.OnChildAgentUpdate += TriggerChildAgentUpdate; InterRegionSingleton.Instance.OnTellRegionToCloseChildConnection += TriggerTellRegionToCloseChildConnection; - } #region Methods called by regions in this instance @@ -629,10 +619,10 @@ namespace OpenSim.Region.Communications.OGS1 OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( - typeof(OGS1InterRegionRemoting), - "tcp://" + regInfo.RemotingAddress + - ":" + regInfo.RemotingPort + - "/InterRegions"); + typeof(OGS1InterRegionRemoting), + "tcp://" + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions"); if (remObject != null) { @@ -738,29 +728,27 @@ namespace OpenSim.Region.Communications.OGS1 //don't want to be creating a new link to the remote instance every time like we are here bool retValue = false; + OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( + typeof(OGS1InterRegionRemoting), + "tcp://" + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions"); - OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( - typeof(OGS1InterRegionRemoting), - "tcp://" + regInfo.RemotingAddress + - ":" + regInfo.RemotingPort + - "/InterRegions"); - - if (remObject != null) - { - retValue = remObject.InformRegionOfChildAgent(regionHandle, new sAgentCircuitData(agentData)); - } - else - { - m_log.Warn("[OGS1 GRID SERVICES]: remoting object not found"); - } - remObject = null; - m_log.Info("[OGS1 GRID SERVICES]: " + - gdebugRegionName + ": OGS1 tried to InformRegionOfChildAgent for " + - agentData.firstname + " " + agentData.lastname + " and got " + - retValue.ToString()); - - return retValue; + if (remObject != null) + { + retValue = remObject.InformRegionOfChildAgent(regionHandle, new sAgentCircuitData(agentData)); + } + else + { + m_log.Warn("[OGS1 GRID SERVICES]: remoting object not found"); + } + remObject = null; + m_log.Info("[OGS1 GRID SERVICES]: " + + gdebugRegionName + ": OGS1 tried to InformRegionOfChildAgent for " + + agentData.firstname + " " + agentData.lastname + " and got " + + retValue.ToString()); + return retValue; } NoteDeadRegion(regionHandle); return false; @@ -849,14 +837,12 @@ namespace OpenSim.Region.Communications.OGS1 //don't want to be creating a new link to the remote instance every time like we are here bool retValue = false; - OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( - typeof ( - OGS1InterRegionRemoting), - "tcp://" + - regInfo.RemotingAddress + - ":" + regInfo.RemotingPort + - "/InterRegions"); + typeof(OGS1InterRegionRemoting), + "tcp://" + + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions"); if (remObject != null) { @@ -939,7 +925,7 @@ namespace OpenSim.Region.Communications.OGS1 /// public bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData) { - int failures = 0; + int failures = 0; lock (m_deadRegionCache) { if (m_deadRegionCache.ContainsKey(regionHandle)) @@ -963,12 +949,11 @@ namespace OpenSim.Region.Communications.OGS1 //don't want to be creating a new link to the remote instance every time like we are here bool retValue = false; - OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( - typeof(OGS1InterRegionRemoting), - "tcp://" + regInfo.RemotingAddress + - ":" + regInfo.RemotingPort + - "/InterRegions"); + typeof(OGS1InterRegionRemoting), + "tcp://" + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions"); if (remObject != null) { @@ -980,7 +965,6 @@ namespace OpenSim.Region.Communications.OGS1 } remObject = null; - return retValue; } NoteDeadRegion(regionHandle); @@ -1050,10 +1034,11 @@ namespace OpenSim.Region.Communications.OGS1 { bool retValue = false; OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( - typeof (OGS1InterRegionRemoting), - "tcp://" + regInfo.RemotingAddress + - ":" + regInfo.RemotingPort + - "/InterRegions"); + typeof (OGS1InterRegionRemoting), + "tcp://" + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions"); + if (remObject != null) { retValue = @@ -1106,10 +1091,11 @@ namespace OpenSim.Region.Communications.OGS1 { bool retValue = false; OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( - typeof (OGS1InterRegionRemoting), - "tcp://" + regInfo.RemotingAddress + - ":" + regInfo.RemotingPort + - "/InterRegions"); + typeof (OGS1InterRegionRemoting), + "tcp://" + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions"); + if (remObject != null) { retValue = @@ -1181,10 +1167,11 @@ namespace OpenSim.Region.Communications.OGS1 { bool retValue = false; OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( - typeof(OGS1InterRegionRemoting), - "tcp://" + regInfo.RemotingAddress + - ":" + regInfo.RemotingPort + - "/InterRegions"); + typeof(OGS1InterRegionRemoting), + "tcp://" + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions"); + if (remObject != null) { retValue = @@ -1211,7 +1198,6 @@ namespace OpenSim.Region.Communications.OGS1 //m_log.Debug(e.ToString()); return false; } - catch (SocketException e) { NoteDeadRegion(regionHandle); @@ -1312,7 +1298,6 @@ namespace OpenSim.Region.Communications.OGS1 { if (m_deadRegionCache.ContainsKey(regionData.RegionHandle)) { - m_deadRegionCache.Remove(regionData.RegionHandle); } } @@ -1356,7 +1341,6 @@ namespace OpenSim.Region.Communications.OGS1 m_localBackend.TriggerExpectPrim(regionHandle, primID, objData); return true; //m_localBackend. - } catch (RemotingException e) { diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs index 61e1af3308..11e94e0e64 100644 --- a/OpenSim/Region/Environment/Scenes/SceneManager.cs +++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs @@ -177,7 +177,7 @@ namespace OpenSim.Region.Environment.Scenes public bool RunTerrainCmdOnCurrentScene(string[] cmdparams, ref string result) { - m_log.Warn("Terrain commands have been depreciated."); + m_log.Warn("Terrain commands have been deprecated."); return false; } @@ -332,11 +332,11 @@ namespace OpenSim.Region.Environment.Scenes public void SetCurrentSceneTimePhase(int timePhase) { ForEachCurrentScene(delegate(Scene scene) - { - scene.SetTimePhase( - timePhase) - ; - }); + { + scene.SetTimePhase( + timePhase) + ; + }); } public void ForceCurrentSceneClientUpdate() diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index 1119db52e4..c63e1f7d33 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs @@ -33,9 +33,7 @@ using OpenSim.Framework; namespace OpenSim.Region.Physics.Manager { public delegate void PositionUpdate(PhysicsVector position); - public delegate void VelocityUpdate(PhysicsVector velocity); - public delegate void OrientationUpdate(Quaternion orientation); public enum ActorTypes : int @@ -50,7 +48,6 @@ namespace OpenSim.Region.Physics.Manager { // Raising the event on the object, so don't need to provide location.. further up the tree knows that info. - public int m_colliderType; public int m_GenericStartEnd; //public uint m_LocalID; @@ -88,13 +85,10 @@ namespace OpenSim.Region.Physics.Manager } } - public abstract class PhysicsActor { public delegate void RequestTerseUpdate(); - public delegate void CollisionUpdate(EventArgs e); - public delegate void OutOfBounds(PhysicsVector pos); #pragma warning disable 67 @@ -138,9 +132,7 @@ namespace OpenSim.Region.Physics.Manager if (handler != null) { - - handler(); - + handler(); } } @@ -150,9 +142,10 @@ namespace OpenSim.Region.Physics.Manager // a race condition if the last subscriber unsubscribes // immediately after the null check and before the event is raised. OutOfBounds handler = OnOutOfBounds; + if (handler != null) { - handler(pos); + handler(pos); } } @@ -162,54 +155,34 @@ namespace OpenSim.Region.Physics.Manager if (handler != null) { - handler(e); + handler(e); } - } - public abstract PhysicsVector Position { get; set; } - public abstract float Mass { get; } - public abstract PhysicsVector Force { get; } - public abstract PhysicsVector GeometricCenter { get; } - public abstract PhysicsVector CenterOfMass { get; } - public abstract PhysicsVector Velocity { get; set; } - public abstract float CollisionScore { get;} - public abstract PhysicsVector Acceleration { get; } - public abstract Quaternion Orientation { get; set; } public abstract int PhysicsActorType { get; set; } - public abstract bool IsPhysical { get; set; } - public abstract bool Flying { get; set; } public abstract bool SetAlwaysRun { get; set; } public abstract bool ThrottleUpdates { get; set; } - public abstract bool IsColliding { get; set; } public abstract bool CollidingGround { get; set; } public abstract bool CollidingObj { get; set; } - public abstract bool FloatOnWater { set; } - public abstract PhysicsVector RotationalVelocity { get; set; } - public abstract bool Kinematic { get; set; } - public abstract float Buoyancy { get; set; } public abstract void AddForce(PhysicsVector force); - public abstract void SetMomentum(PhysicsVector momentum); - - } public class NullPhysicsActor : PhysicsActor @@ -246,7 +219,8 @@ namespace OpenSim.Region.Physics.Manager set { return; } } - public override float Buoyancy { + public override float Buoyancy + { get { return 0f; } set { return; } } @@ -256,7 +230,6 @@ namespace OpenSim.Region.Physics.Manager set { return; } } - public override bool CollidingGround { get { return false; } @@ -313,10 +286,8 @@ namespace OpenSim.Region.Physics.Manager public override void CrossingFailure() { - } - public override Quaternion Orientation { get { return Quaternion.Identity; } @@ -366,17 +337,14 @@ namespace OpenSim.Region.Physics.Manager public override void link(PhysicsActor obj) { - } public override void delink() { - } public override void AddForce(PhysicsVector force) { - return; } public override PhysicsVector RotationalVelocity @@ -387,7 +355,6 @@ namespace OpenSim.Region.Physics.Manager public override void SetMomentum(PhysicsVector momentum) { - return; } } } diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/SensorRepeat.cs index 8fea3a3b1c..c025b5b880 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/SensorRepeat.cs @@ -142,7 +142,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin } public void SenseOnce(uint m_localID, LLUUID m_itemID, - string name, LLUUID keyID, int type, double range, double arc, SceneObjectPart host) + string name, LLUUID keyID, int type, + double range, double arc, SceneObjectPart host) { // Add to timer SenseRepeatClass ts = new SenseRepeatClass(); @@ -210,7 +211,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin foreach (EntityBase ent in m_CmdManager.m_ScriptEngine.World.Entities.Values) { - LLVector3 toRegionPos = ent.AbsolutePosition + regionPos; double dis = Math.Abs((double)Util.GetDistanceTo(toRegionPos, fromRegionPos)); if (dis <= ts.range) diff --git a/prebuild.xml b/prebuild.xml index ce4fa54e18..1d4d4c1f83 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1558,7 +1558,7 @@ - + @@ -1584,8 +1584,6 @@ - -