From efd90b56b761219af6425b1c7a2cdd3b6ffb4de2 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Thu, 27 Dec 2007 21:41:48 +0000 Subject: * Optimized usings * shortened references * Removed redundant 'this' * Normalized EOF --- .../Communications/Local/CommunicationsLocal.cs | 2 +- .../Communications/Local/LocalBackEndServices.cs | 40 ++-- .../Communications/Local/LocalInventoryService.cs | 10 +- .../Communications/Local/LocalLoginService.cs | 14 +- .../Communications/Local/LocalUserServices.cs | 3 +- .../Region/Communications/OGS1/OGS1GridServices.cs | 219 ++++++++++++--------- .../Communications/OGS1/OGS1InterSimComms.cs | 32 +-- .../Communications/OGS1/OGS1InventoryService.cs | 24 +-- .../Region/Communications/OGS1/OGS1UserServices.cs | 29 +-- 9 files changed, 207 insertions(+), 166 deletions(-) (limited to 'OpenSim/Region/Communications') diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs index 937f7c4..575d9d5 100644 --- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs +++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs @@ -50,4 +50,4 @@ namespace OpenSim.Region.Communications.Local m_interRegion = interRegionService; } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs index f6137f7..4dec884 100644 --- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs +++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs @@ -29,8 +29,8 @@ using System.Collections; using System.Collections.Generic; using libsecondlife; using OpenSim.Framework; -using OpenSim.Framework.Console; using OpenSim.Framework.Communications; +using OpenSim.Framework.Console; namespace OpenSim.Region.Communications.Local { @@ -50,21 +50,17 @@ namespace OpenSim.Region.Communications.Local public string gdebugRegionName { get { return _gdebugRegionName; } - set - { - _gdebugRegionName = value; - } + set { _gdebugRegionName = value; } } + public string _rdebugRegionName = ""; public string rdebugRegionName { get { return _rdebugRegionName; } - set - { - _rdebugRegionName = value; - } + set { _rdebugRegionName = value; } } + public LocalBackEndServices() { } @@ -85,7 +81,8 @@ namespace OpenSim.Region.Communications.Local RegionCommsListener regionHost = new RegionCommsListener(); if (m_regionListeners.ContainsKey(regionInfo.RegionHandle)) { - MainLog.Instance.Error("INTERREGION", "Error:Region registered twice as an Events listener for Interregion Communications but not as a listed region. In Standalone mode this will cause BIG issues. In grid mode, it means a region went down and came back up."); + MainLog.Instance.Error("INTERREGION", + "Error:Region registered twice as an Events listener for Interregion Communications but not as a listed region. In Standalone mode this will cause BIG issues. In grid mode, it means a region went down and came back up."); m_regionListeners.Remove(regionInfo.RegionHandle); } m_regionListeners.Add(regionInfo.RegionHandle, regionHost); @@ -195,7 +192,7 @@ namespace OpenSim.Region.Communications.Local return mapBlocks; } - + public virtual bool RegionUp(SearializableRegionInfo sregion, ulong regionhandle) { RegionInfo region = new RegionInfo(sregion); @@ -203,7 +200,7 @@ namespace OpenSim.Region.Communications.Local { return m_regionListeners[regionhandle].TriggerRegionUp(region); } - + return false; } @@ -224,7 +221,7 @@ namespace OpenSim.Region.Communications.Local // It never gets called. public virtual Dictionary GetGridSettings() { - Dictionary returnGridSettings = new Dictionary(); + Dictionary returnGridSettings = new Dictionary(); lock (m_queuedGridSettings) { returnGridSettings = m_queuedGridSettings; @@ -237,7 +234,6 @@ namespace OpenSim.Region.Communications.Local public virtual void SetForcefulBanlistsDisallowed(ulong regionHandle) { m_queuedGridSettings.Add("allow_forceful_banlines", "FALSE"); - } public bool TriggerRegionUp(RegionInfo region, ulong regionhandle) @@ -254,7 +250,7 @@ namespace OpenSim.Region.Communications.Local { if (m_regionListeners.ContainsKey(regionHandle)) { - return m_regionListeners[regionHandle].TriggerChildAgentUpdate(regionHandle,cAgentData); + return m_regionListeners[regionHandle].TriggerChildAgentUpdate(regionHandle, cAgentData); } return false; } @@ -282,7 +278,7 @@ namespace OpenSim.Region.Communications.Local return false; } - public bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData) + public bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData) { if (m_regionListeners.ContainsKey(regionHandle)) { @@ -291,6 +287,7 @@ namespace OpenSim.Region.Communications.Local } return false; } + /// /// /// @@ -308,6 +305,7 @@ namespace OpenSim.Region.Communications.Local } return false; } + public bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical) { if (m_regionListeners.ContainsKey(regionHandle)) @@ -322,7 +320,7 @@ namespace OpenSim.Region.Communications.Local { if (m_regionListeners.ContainsKey(regionHandle)) { - m_regionListeners[regionHandle].TriggerCloseAgentConnection(regionHandle, agentID); + m_regionListeners[regionHandle].TriggerCloseAgentConnection(regionHandle, agentID); } } @@ -334,6 +332,7 @@ namespace OpenSim.Region.Communications.Local } return false; } + public bool AcknowledgePrimCrossed(ulong regionHandle, LLUUID primID) { if (m_regionListeners.ContainsKey(regionHandle)) @@ -415,14 +414,15 @@ namespace OpenSim.Region.Communications.Local { if (m_regionListeners.ContainsKey(regionHandle)) { - return m_regionListeners[regionHandle].TriggerExpectPrimCrossing(regionHandle, primID, position, isPhysical); + return + m_regionListeners[regionHandle].TriggerExpectPrimCrossing(regionHandle, primID, position, isPhysical); } return false; } public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData) { - // MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: Other local region is sending child agent our way: " + agentData.firstname + " " + agentData.lastname); + // MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: Other local region is sending child agent our way: " + agentData.firstname + " " + agentData.lastname); if (m_regionListeners.ContainsKey(regionHandle)) { @@ -435,4 +435,4 @@ namespace OpenSim.Region.Communications.Local return false; } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs index 08bd850..730c40f 100644 --- a/OpenSim/Region/Communications/Local/LocalInventoryService.cs +++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs @@ -82,14 +82,14 @@ namespace OpenSim.Region.Communications.Local { DeleteItem(item); } - + /// /// Send the given inventory folder and its item contents back to the requester. /// /// /// private InventoryFolderImpl RequestInventoryFolder(LLUUID userID, InventoryFolderBase folder, - InventoryFolderInfo folderCallBack, + InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack) { InventoryFolderImpl newFolder = new InventoryFolderImpl(folder); @@ -99,9 +99,9 @@ namespace OpenSim.Region.Communications.Local foreach (InventoryItemBase item in items) { itemCallBack(userID, item); - } - + } + return newFolder; } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs index 2c08707..bf5f205 100644 --- a/OpenSim/Region/Communications/Local/LocalLoginService.cs +++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs @@ -73,7 +73,7 @@ namespace OpenSim.Region.Communications.Local if (!authUsers) { //no current user account so make one - MainLog.Instance.Notice("LOGIN", "No user account found so creating a new one."); + MainLog.Instance.Notice("LOGIN", "No user account found so creating a new one."); m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY); @@ -93,14 +93,14 @@ namespace OpenSim.Region.Communications.Local if (!authUsers) { //for now we will accept any password in sandbox mode - MainLog.Instance.Notice("LOGIN", "Authorising user (no actual password check)"); - + MainLog.Instance.Notice("LOGIN", "Authorising user (no actual password check)"); + return true; } else { MainLog.Instance.Notice( - "LOGIN", "Authenticating " + profile.username + " " + profile.surname); + "LOGIN", "Authenticating " + profile.username + " " + profile.surname); password = password.Remove(0, 3); //remove $1$ @@ -134,7 +134,7 @@ namespace OpenSim.Region.Communications.Local // response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CapsSeed/" + capsPath + "0000/"; theUser.currentAgent.currentRegion = reg.RegionID; theUser.currentAgent.currentHandle = reg.RegionHandle; - + LoginResponse.BuddyList buddyList = new LoginResponse.BuddyList(); buddyList.AddNewBuddy(new LoginResponse.BuddyList.BuddyInfo("11111111-1111-0000-0000-000100bba000")); response.BuddList = buddyList; @@ -157,7 +157,7 @@ namespace OpenSim.Region.Communications.Local } else { - MainLog.Instance.Warn("LOGIN", "Not found region " + currentRegion); + MainLog.Instance.Warn("LOGIN", "Not found region " + currentRegion); } } @@ -207,4 +207,4 @@ namespace OpenSim.Region.Communications.Local } } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs index d8c4b1d..6269565 100644 --- a/OpenSim/Region/Communications/Local/LocalUserServices.cs +++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs @@ -27,6 +27,7 @@ */ using System; +using libsecondlife; using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.UserManagement; @@ -82,7 +83,7 @@ namespace OpenSim.Region.Communications.Local return profile; } - public override UserProfileData SetupMasterUser(libsecondlife.LLUUID uuid) + public override UserProfileData SetupMasterUser(LLUUID uuid) { UserProfileData data = GetUserProfile(uuid); if (data == null) diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 2754c4e..8d52eeb 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -60,23 +60,17 @@ namespace OpenSim.Region.Communications.OGS1 public string gdebugRegionName { get { return _gdebugRegionName; } - set - { - _gdebugRegionName = value; - - } + set { _gdebugRegionName = value; } } + public string _rdebugRegionName = ""; public string rdebugRegionName { get { return _rdebugRegionName; } - set - { - _rdebugRegionName = value; - - } + set { _rdebugRegionName = value; } } + /// /// /// @@ -128,7 +122,7 @@ namespace OpenSim.Region.Communications.OGS1 // Process Response if (GridRespData.ContainsKey("error")) { - string errorstring = (string)GridRespData["error"]; + string errorstring = (string) GridRespData["error"]; MainLog.Instance.Error("Unable to connect to grid: " + errorstring); return null; } @@ -137,14 +131,12 @@ namespace OpenSim.Region.Communications.OGS1 m_knownRegions = RequestNeighbours(regionInfo.RegionLocX, regionInfo.RegionLocY); if (GridRespData.ContainsKey("allow_forceful_banlines")) { - - if ((string)GridRespData["allow_forceful_banlines"] != "TRUE") + if ((string) GridRespData["allow_forceful_banlines"] != "TRUE") { //m_localBackend.SetForcefulBanlistsDisallowed(regionInfo.RegionHandle); m_queuedGridSettings.Add("allow_forceful_banlines", "FALSE"); } } - } return m_localBackend.RegisterRegion(regionInfo); } @@ -153,6 +145,7 @@ namespace OpenSim.Region.Communications.OGS1 { return false; } + public virtual Dictionary GetGridSettings() { Dictionary returnGridSettings = new Dictionary(); @@ -161,15 +154,15 @@ namespace OpenSim.Region.Communications.OGS1 foreach (string Dictkey in m_queuedGridSettings.Keys) { returnGridSettings.Add(Dictkey, m_queuedGridSettings[Dictkey]); - } - + m_queuedGridSettings.Clear(); } return returnGridSettings; } + /// /// /// @@ -223,7 +216,7 @@ namespace OpenSim.Region.Communications.OGS1 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000); - Hashtable responseData = (Hashtable)GridResp.Value; + Hashtable responseData = (Hashtable) GridResp.Value; if (responseData.ContainsKey("error")) { @@ -231,29 +224,30 @@ namespace OpenSim.Region.Communications.OGS1 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 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"]; + string externalUri = (string) responseData["sim_uri"]; - IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int)port); + 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.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); regionInfo.RemotingAddress = internalIpStr; - regionInfo.RegionID = new LLUUID((string)responseData["region_UUID"]); - regionInfo.RegionName = (string)responseData["region_name"]; + regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]); + regionInfo.RegionName = (string) responseData["region_name"]; if (requestData.ContainsKey("regionHandle")) { - m_remoteRegionInfoCache.Add(Convert.ToUInt64((string)requestData["regionHandle"]), regionInfo); + m_remoteRegionInfoCache.Add(Convert.ToUInt64((string) requestData["regionHandle"]), regionInfo); } return regionInfo; } + /// /// /// @@ -283,7 +277,7 @@ namespace OpenSim.Region.Communications.OGS1 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000); - Hashtable responseData = (Hashtable)GridResp.Value; + Hashtable responseData = (Hashtable) GridResp.Value; if (responseData.ContainsKey("error")) { @@ -291,27 +285,29 @@ namespace OpenSim.Region.Communications.OGS1 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 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"]; + string externalUri = (string) responseData["sim_uri"]; - IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int)port); + 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.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); regionInfo.RemotingAddress = internalIpStr; - regionInfo.RegionID = new LLUUID((string)responseData["region_UUID"]); - regionInfo.RegionName = (string)responseData["region_name"]; + regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]); + regionInfo.RegionName = (string) responseData["region_name"]; m_remoteRegionInfoCache.Add(regionHandle, regionInfo); } - catch (System.Net.WebException) + catch (WebException) { - MainLog.Instance.Error("GRID", "Region lookup failed for: " + regionHandle.ToString() + " - Is the GridServer down?"); + MainLog.Instance.Error("GRID", + "Region lookup failed for: " + regionHandle.ToString() + + " - Is the GridServer down?"); return null; } } @@ -462,12 +458,7 @@ namespace OpenSim.Region.Communications.OGS1 return new XmlRpcResponse(); } - - - - - #region m_interRegion Comms /// @@ -510,8 +501,8 @@ namespace OpenSim.Region.Communications.OGS1 bool retValue = false; - OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( - typeof(OGS1InterRegionRemoting), + OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( + typeof (OGS1InterRegionRemoting), "tcp://" + regInfo.RemotingAddress + ":" + regInfo.RemotingPort + "/InterRegions"); @@ -525,7 +516,10 @@ namespace OpenSim.Region.Communications.OGS1 Console.WriteLine("remoting object not found"); } remObject = null; - MainLog.Instance.Verbose("INTER", gdebugRegionName + ": OGS1 tried to Update Child Agent data on outside region and got " + retValue.ToString()); + MainLog.Instance.Verbose("INTER", + gdebugRegionName + + ": OGS1 tried to Update Child Agent data on outside region and got " + + retValue.ToString()); return retValue; } @@ -534,35 +528,39 @@ namespace OpenSim.Region.Communications.OGS1 } catch (RemotingException e) { - MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); MainLog.Instance.Debug(e.ToString()); return false; } catch (SocketException e) { - MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + + regInfo.RegionLocX + "," + regInfo.RegionLocY); MainLog.Instance.Debug(e.ToString()); return false; } catch (InvalidCredentialException e) { - MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName + + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); MainLog.Instance.Debug(e.ToString()); return false; } catch (AuthenticationException e) { - MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); MainLog.Instance.Debug(e.ToString()); return false; } catch (Exception e) { - MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName + + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); MainLog.Instance.Debug(e.ToString()); return false; } - } /// @@ -571,7 +569,6 @@ namespace OpenSim.Region.Communications.OGS1 /// /// /// - public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) { RegionInfo regInfo = null; @@ -604,7 +601,10 @@ namespace OpenSim.Region.Communications.OGS1 Console.WriteLine("remoting object not found"); } remObject = null; - MainLog.Instance.Verbose("INTER", gdebugRegionName + ": OGS1 tried to InformRegionOfChildAgent for " + agentData.firstname + " " + agentData.lastname + " and got " + retValue.ToString()); + MainLog.Instance.Verbose("INTER", + gdebugRegionName + ": OGS1 tried to InformRegionOfChildAgent for " + + agentData.firstname + " " + agentData.lastname + " and got " + + retValue.ToString()); return retValue; } @@ -613,31 +613,36 @@ namespace OpenSim.Region.Communications.OGS1 } catch (RemotingException e) { - MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); MainLog.Instance.Debug(e.ToString()); return false; } catch (SocketException e) { - MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + + regInfo.RegionLocX + "," + regInfo.RegionLocY); MainLog.Instance.Debug(e.ToString()); return false; } catch (InvalidCredentialException e) { - MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName + + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); MainLog.Instance.Debug(e.ToString()); return false; } catch (AuthenticationException e) { - MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); MainLog.Instance.Debug(e.ToString()); return false; } catch (Exception e) { - MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName + + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); MainLog.Instance.Debug(e.ToString()); return false; } @@ -656,7 +661,7 @@ namespace OpenSim.Region.Communications.OGS1 region = new SearializableRegionInfo(RequestNeighbourInfo(region.RegionHandle)); region.RemotingAddress = region.ExternalHostName; region.RemotingPort = NetworkServersInfo.RemotingListenerPort; - if (m_localBackend.RegionUp(region,regionhandle)) + if (m_localBackend.RegionUp(region, regionhandle)) { return true; } @@ -671,9 +676,11 @@ namespace OpenSim.Region.Communications.OGS1 bool retValue = false; - OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( - typeof(OGS1InterRegionRemoting), - "tcp://" + regInfo.RemotingAddress + + OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( + typeof ( + OGS1InterRegionRemoting), + "tcp://" + + regInfo.RemotingAddress + ":" + regInfo.RemotingPort + "/InterRegions"); @@ -703,33 +710,39 @@ namespace OpenSim.Region.Communications.OGS1 } catch (RemotingException e) { - MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress + - ":" + regInfo.RemotingPort + - "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + " - Is this neighbor up?"); + MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region using tcp://" + + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + + " - Is this neighbor up?"); MainLog.Instance.Debug(e.ToString()); return false; } catch (SocketException e) { - MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress + - ":" + regInfo.RemotingPort + - "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + " - Is this neighbor up?"); + MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region using tcp://" + + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + + " - Is this neighbor up?"); MainLog.Instance.Debug(e.ToString()); return false; } catch (InvalidCredentialException e) { - MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress + - ":" + regInfo.RemotingPort + - "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region using tcp://" + + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); MainLog.Instance.Debug(e.ToString()); return false; } catch (AuthenticationException e) { - MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress + - ":" + regInfo.RemotingPort + - "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region using tcp://" + + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); MainLog.Instance.Debug(e.ToString()); return false; } @@ -737,25 +750,25 @@ namespace OpenSim.Region.Communications.OGS1 { // This line errors with a Null Reference Exception.. Why? @.@ //MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress + - // ":" + regInfo.RemotingPort + - //"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + " - This is likely caused by an incompatibility in the protocol between this sim and that one"); + // ":" + regInfo.RemotingPort + + //"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + " - This is likely caused by an incompatibility in the protocol between this sim and that one"); MainLog.Instance.Debug(e.ToString()); return false; } } + /// /// /// /// /// /// - public bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData) { RegionInfo regInfo = null; try { - if (m_localBackend.InformRegionOfPrimCrossing(regionHandle,primID, objData)) + if (m_localBackend.InformRegionOfPrimCrossing(regionHandle, primID, objData)) { return true; } @@ -775,7 +788,7 @@ namespace OpenSim.Region.Communications.OGS1 if (remObject != null) { - retValue = remObject.InformRegionOfPrimCrossing(regionHandle,primID.UUID, objData); + retValue = remObject.InformRegionOfPrimCrossing(regionHandle, primID.UUID, objData); } else { @@ -791,35 +804,41 @@ namespace OpenSim.Region.Communications.OGS1 } catch (RemotingException e) { - MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); MainLog.Instance.Debug(e.ToString()); return false; } catch (SocketException e) { - MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + + regInfo.RegionLocX + "," + regInfo.RegionLocY); MainLog.Instance.Debug(e.ToString()); return false; } catch (InvalidCredentialException e) { - MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName + + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); MainLog.Instance.Debug(e.ToString()); return false; } catch (AuthenticationException e) { - MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); MainLog.Instance.Debug(e.ToString()); return false; } catch (Exception e) { - MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName + + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); MainLog.Instance.Debug(e.ToString()); return false; } } + /// /// /// @@ -848,7 +867,9 @@ namespace OpenSim.Region.Communications.OGS1 "/InterRegions"); if (remObject != null) { - retValue = remObject.ExpectAvatarCrossing(regionHandle, agentID.UUID, new sLLVector3(position), isFlying); + retValue = + remObject.ExpectAvatarCrossing(regionHandle, agentID.UUID, new sLLVector3(position), + isFlying); } else { @@ -864,7 +885,8 @@ namespace OpenSim.Region.Communications.OGS1 } catch (RemotingException e) { - MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); MainLog.Instance.Debug(e.ToString()); return false; } @@ -873,6 +895,7 @@ namespace OpenSim.Region.Communications.OGS1 return false; } } + public bool ExpectPrimCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isPhysical) { RegionInfo regInfo = null; @@ -887,14 +910,16 @@ namespace OpenSim.Region.Communications.OGS1 if (regInfo != null) { bool retValue = false; - OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( - typeof(OGS1InterRegionRemoting), + OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( + typeof (OGS1InterRegionRemoting), "tcp://" + regInfo.RemotingAddress + ":" + regInfo.RemotingPort + "/InterRegions"); if (remObject != null) { - retValue = remObject.ExpectAvatarCrossing(regionHandle, agentID.UUID, new sLLVector3(position), isPhysical); + retValue = + remObject.ExpectAvatarCrossing(regionHandle, agentID.UUID, new sLLVector3(position), + isPhysical); } else { @@ -910,7 +935,8 @@ namespace OpenSim.Region.Communications.OGS1 } catch (RemotingException e) { - MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); MainLog.Instance.Debug(e.ToString()); return false; } @@ -922,7 +948,6 @@ namespace OpenSim.Region.Communications.OGS1 public void TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID) { - } public bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId) @@ -934,6 +959,7 @@ namespace OpenSim.Region.Communications.OGS1 { return m_localBackend.AcknowledgePrimCrossed(regionHandle, primId); } + #endregion #region Methods triggered by calls from external instances @@ -961,8 +987,9 @@ namespace OpenSim.Region.Communications.OGS1 public bool TriggerRegionUp(SearializableRegionInfo regionData, ulong regionhandle) { - - MainLog.Instance.Verbose("INTER", gdebugRegionName + "Incoming OGS1 RegionUpReport: " + "(" + regionData.RegionLocX + "," + regionData.RegionLocY + ")"); + MainLog.Instance.Verbose("INTER", + gdebugRegionName + "Incoming OGS1 RegionUpReport: " + "(" + regionData.RegionLocX + + "," + regionData.RegionLocY + ")"); try { @@ -975,6 +1002,7 @@ namespace OpenSim.Region.Communications.OGS1 return false; } } + public bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) { MainLog.Instance.Verbose("INTER", "Incoming OGS1 Child Agent Data Update"); @@ -988,7 +1016,6 @@ namespace OpenSim.Region.Communications.OGS1 MainLog.Instance.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); return false; } - } /// @@ -1012,6 +1039,7 @@ namespace OpenSim.Region.Communications.OGS1 return false; } } + /// /// /// @@ -1031,6 +1059,7 @@ namespace OpenSim.Region.Communications.OGS1 return false; } } + public bool TriggerExpectPrimCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isPhysical) { try @@ -1048,4 +1077,4 @@ namespace OpenSim.Region.Communications.OGS1 #endregion } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs index 683c471..a0da07e 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs @@ -41,7 +41,7 @@ namespace OpenSim.Region.Communications.OGS1 public delegate bool PrimGroupArrival(ulong regionHandle, LLUUID primID, string objData); - public delegate bool RegionUp (SearializableRegionInfo region, ulong regionhandle); + public delegate bool RegionUp(SearializableRegionInfo region, ulong regionhandle); public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate childUpdate); @@ -81,7 +81,6 @@ namespace OpenSim.Region.Communications.OGS1 public bool RegionUp(SearializableRegionInfo sregion, ulong regionhandle) { - if (OnRegionUp != null) { return OnRegionUp(sregion, regionhandle); @@ -106,6 +105,7 @@ namespace OpenSim.Region.Communications.OGS1 } return false; } + public bool InformRegionPrim(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical) { if (OnPrimGroupNear != null) @@ -114,6 +114,7 @@ namespace OpenSim.Region.Communications.OGS1 } return false; } + public bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, string objData) { if (OnPrimGroupArrival != null) @@ -134,7 +135,8 @@ namespace OpenSim.Region.Communications.OGS1 { try { - return InterRegionSingleton.Instance.InformRegionOfChildAgent(regionHandle, new AgentCircuitData(agentData)); + return + InterRegionSingleton.Instance.InformRegionOfChildAgent(regionHandle, new AgentCircuitData(agentData)); } catch (RemotingException e) { @@ -142,7 +144,8 @@ namespace OpenSim.Region.Communications.OGS1 return false; } } - public bool RegionUp(SearializableRegionInfo region, ulong regionhandle) + + public bool RegionUp(SearializableRegionInfo region, ulong regionhandle) { try { @@ -155,25 +158,27 @@ namespace OpenSim.Region.Communications.OGS1 } } - public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) + public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) { try { - return InterRegionSingleton.Instance.ChildAgentUpdate(regionHandle,cAgentData); + return InterRegionSingleton.Instance.ChildAgentUpdate(regionHandle, cAgentData); } catch (RemotingException e) { Console.WriteLine("Remoting Error: Unable to send Child agent update to remote region.\n" + e.ToString()); return false; } - } public bool ExpectAvatarCrossing(ulong regionHandle, Guid agentID, sLLVector3 position, bool isFlying) { try { - return InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, new LLUUID(agentID), new LLVector3(position.x,position.y,position.z), isFlying); + return + InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, new LLUUID(agentID), + new LLVector3(position.x, position.y, position.z), + isFlying); } catch (RemotingException e) { @@ -181,20 +186,24 @@ namespace OpenSim.Region.Communications.OGS1 return false; } } + public bool InformRegionPrim(ulong regionHandle, Guid SceneObjectGroupID, sLLVector3 position, bool isPhysical) { try { - return InterRegionSingleton.Instance.InformRegionPrim(regionHandle, new LLUUID(SceneObjectGroupID), new LLVector3(position.x,position.y,position.z), isPhysical); + return + InterRegionSingleton.Instance.InformRegionPrim(regionHandle, new LLUUID(SceneObjectGroupID), + new LLVector3(position.x, position.y, position.z), + isPhysical); } catch (RemotingException e) { Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); return false; } - } - public bool InformRegionOfPrimCrossing(ulong regionHandle,Guid primID, string objData) + + public bool InformRegionOfPrimCrossing(ulong regionHandle, Guid primID, string objData) { try { @@ -206,6 +215,5 @@ namespace OpenSim.Region.Communications.OGS1 return false; } } - } } \ No newline at end of file diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs index 0fb083a..0d97074 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs @@ -29,10 +29,10 @@ using System; using System.Collections.Generic; using libsecondlife; using OpenSim.Framework; -using OpenSim.Framework.Servers; using OpenSim.Framework.Communications; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Console; +using OpenSim.Framework.Servers; namespace OpenSim.Region.Communications.OGS1 { @@ -51,7 +51,7 @@ namespace OpenSim.Region.Communications.OGS1 // See IInventoryServices public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack) - { + { if (!m_RequestingInventory.ContainsKey(userID)) { InventoryRequest request = new InventoryRequest(userID, folderCallBack, itemCallBack); @@ -72,10 +72,10 @@ namespace OpenSim.Region.Communications.OGS1 try { MainLog.Instance.Verbose( - "INVENTORY", "Requesting inventory from {0}/GetInventory/ for user {1}", + "INVENTORY", "Requesting inventory from {0}/GetInventory/ for user {1}", _inventoryServerUrl, userID); - - RestObjectPosterResponse requester + + RestObjectPosterResponse requester = new RestObjectPosterResponse(); requester.ResponseCallback = InventoryResponse; @@ -96,10 +96,10 @@ namespace OpenSim.Region.Communications.OGS1 LLUUID userID = response.UserID; if (m_RequestingInventory.ContainsKey(userID)) { - MainLog.Instance.Verbose("INVENTORY", - "Received inventory response for user {0} containing {1} folders and {2} items", + MainLog.Instance.Verbose("INVENTORY", + "Received inventory response for user {0} containing {1} folders and {2} items", userID, response.Folders.Count, response.AllItems.Count); - + InventoryFolderImpl rootFolder = null; InventoryRequest request = m_RequestingInventory[userID]; foreach (InventoryFolderBase folder in response.Folders) @@ -133,8 +133,8 @@ namespace OpenSim.Region.Communications.OGS1 else { MainLog.Instance.Warn( - "INVENTORY", - "Received inventory response for {0} for which we do not have a record of requesting!", + "INVENTORY", + "Received inventory response for {0} for which we do not have a record of requesting!", userID); } } @@ -150,7 +150,7 @@ namespace OpenSim.Region.Communications.OGS1 SynchronousRestObjectPoster.BeginPostObject( "POST", _inventoryServerUrl + "/MoveFolder/", folder); } - + public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) { SynchronousRestObjectPoster.BeginPostObject( @@ -188,4 +188,4 @@ namespace OpenSim.Region.Communications.OGS1 } } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs index c1e6ba6..3a2e138 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs @@ -30,6 +30,7 @@ using System; using System.Collections; using System.Collections.Generic; using System.Net; +using System.Text.RegularExpressions; using libsecondlife; using Nwc.XmlRpc; using OpenSim.Framework; @@ -50,7 +51,9 @@ namespace OpenSim.Region.Communications.OGS1 { if (data.Contains("error_type")) { - MainLog.Instance.Warn("GRID", "Error sent by user server when trying to get user profile: (" + data["error_type"] + + MainLog.Instance.Warn("GRID", + "Error sent by user server when trying to get user profile: (" + + data["error_type"] + "): " + data["error_desc"]); return null; } @@ -80,19 +83,19 @@ namespace OpenSim.Region.Communications.OGS1 return userData; } - public List ConvertXMLRPCDataToAvatarPickerList(LLUUID queryID,Hashtable data) + public List ConvertXMLRPCDataToAvatarPickerList(LLUUID queryID, Hashtable data) { List pickerlist = new List(); - int pickercount = Convert.ToInt32((string)data["avcount"]); - LLUUID respqueryID = new LLUUID((string)data["queryid"]); + int pickercount = Convert.ToInt32((string) data["avcount"]); + LLUUID respqueryID = new LLUUID((string) data["queryid"]); if (queryID == respqueryID) { for (int i = 0; i < pickercount; i++) { AvatarPickerAvatar apicker = new AvatarPickerAvatar(); - LLUUID avatarID = new LLUUID((string)data["avatarid" + i.ToString()]); - string firstname = (string)data["firstname" + i.ToString()]; - string lastname = (string)data["lastname" + i.ToString()]; + LLUUID avatarID = new LLUUID((string) data["avatarid" + i.ToString()]); + string firstname = (string) data["firstname" + i.ToString()]; + string lastname = (string) data["lastname" + i.ToString()]; apicker.AvatarID = avatarID; apicker.firstName = firstname; apicker.lastName = lastname; @@ -114,18 +117,18 @@ namespace OpenSim.Region.Communications.OGS1 public List GenerateAgentPickerRequestResponse(LLUUID queryID, string query) { List pickerlist = new List(); - System.Text.RegularExpressions.Regex objAlphaNumericPattern = new System.Text.RegularExpressions.Regex("[^a-zA-Z0-9 ]"); + Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9 ]"); try { Hashtable param = new Hashtable(); - param["queryid"] = (string)queryID.ToString(); + param["queryid"] = (string) queryID.ToString(); param["avquery"] = objAlphaNumericPattern.Replace(query, ""); IList parameters = new ArrayList(); parameters.Add(param); XmlRpcRequest req = new XmlRpcRequest("get_avatar_picker_avatar", parameters); XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); - Hashtable respData = (Hashtable)resp.Value; - pickerlist = ConvertXMLRPCDataToAvatarPickerList(queryID,respData); + Hashtable respData = (Hashtable) resp.Value; + pickerlist = ConvertXMLRPCDataToAvatarPickerList(queryID, respData); } catch (WebException e) { @@ -196,7 +199,7 @@ namespace OpenSim.Region.Communications.OGS1 return profile; } - public UserProfileData SetupMasterUser(libsecondlife.LLUUID uuid) + public UserProfileData SetupMasterUser(LLUUID uuid) { UserProfileData data = GetUserProfile(uuid); if (data == null) @@ -211,4 +214,4 @@ namespace OpenSim.Region.Communications.OGS1 throw new Exception("The method or operation is not implemented."); } } -} +} \ No newline at end of file -- cgit v1.1