From 4bde56457f574060c1aaaca8effba1f6fe00b6c7 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Thu, 6 Dec 2007 01:41:41 +0000 Subject: removed some duplicate hard-coded port numbers. changed ports to uint. --- OpenSim/Framework/Communications/Capabilities/Caps.cs | 4 ++-- OpenSim/Framework/Communications/LoginResponse.cs | 4 ++-- OpenSim/Framework/Console/LogBase.cs | 6 +++--- OpenSim/Framework/InventoryConfig.cs | 4 ++-- OpenSim/Framework/NetworkServersInfo.cs | 10 +++++----- OpenSim/Framework/RegionInfo.cs | 7 +++---- OpenSim/Framework/SerializableRegionInfo.cs | 6 ++---- OpenSim/Framework/Servers/BaseHttpServer.cs | 8 ++++---- OpenSim/Framework/UserConfig.cs | 2 +- OpenSim/Grid/AssetServer/Main.cs | 2 +- OpenSim/Grid/GridServer/Main.cs | 2 +- OpenSim/Grid/UserServer/Main.cs | 2 +- OpenSim/Grid/UserServer/UserLoginService.cs | 4 ++-- OpenSim/Region/ClientStack/RegionApplicationBase.cs | 4 ++-- OpenSim/Region/ClientStack/UDPServer.cs | 8 ++++---- OpenSim/Region/Communications/Local/LocalLoginService.cs | 3 +-- OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | 6 +++--- OpenSim/Region/Environment/Modules/ChatModule.cs | 6 +++--- OpenSim/Region/Examples/SimpleApp/Program.cs | 2 +- 19 files changed, 43 insertions(+), 47 deletions(-) diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index 51a4598..4603280 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs @@ -50,7 +50,7 @@ namespace OpenSim.Region.Capabilities public class Caps { private string m_httpListenerHostName; - private int m_httpListenPort; + private uint m_httpListenPort; private string m_capsObjectPath = "00001-"; private string m_requestPath = "0000/"; private string m_mapLayerPath = "0001/"; @@ -68,7 +68,7 @@ namespace OpenSim.Region.Capabilities public NewInventoryItem AddNewInventoryItem = null; public ItemUpdatedCallback ItemUpdatedCall = null; - public Caps(AssetCache assetCache, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath, + public Caps(AssetCache assetCache, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, LLUUID agent, bool dumpAssetsToFile) { m_assetCache = assetCache; diff --git a/OpenSim/Framework/Communications/LoginResponse.cs b/OpenSim/Framework/Communications/LoginResponse.cs index dccba1c..bce518b 100644 --- a/OpenSim/Framework/Communications/LoginResponse.cs +++ b/OpenSim/Framework/Communications/LoginResponse.cs @@ -70,7 +70,7 @@ namespace OpenSim.Framework.UserManagement private string gendered; private string everLoggedIn; private string login; - private int simPort; + private uint simPort; private string simAddress; private string agentAccess; private Int32 circuitCode; @@ -369,7 +369,7 @@ namespace OpenSim.Framework.UserManagement set { everLoggedIn = value; } } // EverLoggedIn - public int SimPort + public uint SimPort { get { return simPort; } set { simPort = value; } diff --git a/OpenSim/Framework/Console/LogBase.cs b/OpenSim/Framework/Console/LogBase.cs index 99c0128..c226fcb 100644 --- a/OpenSim/Framework/Console/LogBase.cs +++ b/OpenSim/Framework/Console/LogBase.cs @@ -345,15 +345,15 @@ namespace OpenSim.Framework.Console return address; } - public int CmdPromptIPPort(string prompt, string defaultvalue) + public uint CmdPromptIPPort(string prompt, string defaultvalue) { - int port; + uint port; string portStr; while (true) { portStr = MainLog.Instance.CmdPrompt(prompt, defaultvalue); - if (int.TryParse(portStr, out port)) + if (uint.TryParse(portStr, out port)) { if (port >= IPEndPoint.MinPort && port <= IPEndPoint.MaxPort) { diff --git a/OpenSim/Framework/InventoryConfig.cs b/OpenSim/Framework/InventoryConfig.cs index 554cd30..87731a5 100644 --- a/OpenSim/Framework/InventoryConfig.cs +++ b/OpenSim/Framework/InventoryConfig.cs @@ -13,7 +13,7 @@ namespace OpenSim.Framework public string DatabaseProvider = ""; public static uint DefaultHttpPort = 8004; - public int HttpPort = 8004; + public uint HttpPort = DefaultHttpPort; private ConfigurationMember configMember; @@ -63,7 +63,7 @@ namespace OpenSim.Framework DatabaseProvider = (string) configuration_result; break; case "http_port": - HttpPort = (int) configuration_result; + HttpPort = (uint) configuration_result; break; } diff --git a/OpenSim/Framework/NetworkServersInfo.cs b/OpenSim/Framework/NetworkServersInfo.cs index 1c76320..b3e79b7 100644 --- a/OpenSim/Framework/NetworkServersInfo.cs +++ b/OpenSim/Framework/NetworkServersInfo.cs @@ -45,10 +45,10 @@ namespace OpenSim.Framework public string InventoryURL = ""; - public static int DefaultHttpListenerPort = 9000; - public int HttpListenerPort = DefaultHttpListenerPort; + public static uint DefaultHttpListenerPort = 9000; + public uint HttpListenerPort = DefaultHttpListenerPort; - public static int RemotingListenerPort = 8895; + public static uint RemotingListenerPort = 8895; public NetworkServersInfo() @@ -80,8 +80,8 @@ namespace OpenSim.Framework m_defaultHomeLocX = (uint) config.Configs["StandAlone"].GetInt("default_location_x", 1000); m_defaultHomeLocY = (uint) config.Configs["StandAlone"].GetInt("default_location_y", 1000); - HttpListenerPort = config.Configs["Network"].GetInt("http_listener_port", DefaultHttpListenerPort); - RemotingListenerPort = config.Configs["Network"].GetInt("remoting_listener_port", RemotingListenerPort); + HttpListenerPort = (uint) config.Configs["Network"].GetInt("http_listener_port", (int) DefaultHttpListenerPort); + RemotingListenerPort = (uint) config.Configs["Network"].GetInt("remoting_listener_port", (int) RemotingListenerPort); GridURL = config.Configs["Network"].GetString("grid_server_url", "http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString()); diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index dd4078b..d94a890 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -56,15 +56,14 @@ namespace OpenSim.Framework m_externalHostName = externalUri; } - public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, int port) + public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port) { - m_regionLocX = regionLocX; m_regionLocY = regionLocY; m_externalHostName = externalUri; - m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port); + m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port); } public LLUUID RegionID = LLUUID.Zero; @@ -270,7 +269,7 @@ namespace OpenSim.Framework { errorMessage = "needs an IP Address (IPAddress)"; } - this.m_internalEndPoint.Port = source.Configs[sectionName].GetInt("internal_ip_port", NetworkServersInfo.DefaultHttpListenerPort); + this.m_internalEndPoint.Port = source.Configs[sectionName].GetInt("internal_ip_port", (int) NetworkServersInfo.DefaultHttpListenerPort); string externalHost = source.Configs[sectionName].GetString("external_host_name", "127.0.0.1"); if (externalHost != "SYSTEMIP") diff --git a/OpenSim/Framework/SerializableRegionInfo.cs b/OpenSim/Framework/SerializableRegionInfo.cs index dc440b6..c7e7d27 100644 --- a/OpenSim/Framework/SerializableRegionInfo.cs +++ b/OpenSim/Framework/SerializableRegionInfo.cs @@ -51,7 +51,6 @@ namespace OpenSim.Framework m_externalHostName = ConvertFrom.ExternalHostName; m_remotingPort = ConvertFrom.RemotingPort; RemotingAddress = ConvertFrom.RemotingAddress; - } public SearializableRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) { @@ -63,15 +62,14 @@ namespace OpenSim.Framework m_externalHostName = externalUri; } - public SearializableRegionInfo(uint regionLocX, uint regionLocY, string externalUri, int port) + public SearializableRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port) { - m_regionLocX = regionLocX; m_regionLocY = regionLocY; m_externalHostName = externalUri; - m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port); + m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port); } public LLUUID RegionID = LLUUID.Zero; diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index 889eaef..1baf073 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -44,21 +44,21 @@ namespace OpenSim.Framework.Servers protected HttpListener m_httpListener; protected Dictionary m_rpcHandlers = new Dictionary(); protected Dictionary m_streamHandlers = new Dictionary(); - protected int m_port; + protected uint m_port; protected bool m_ssl = false; protected bool m_firstcaps = true; - public int Port + public uint Port { get { return m_port; } } - public BaseHttpServer(int port) + public BaseHttpServer(uint port) { m_port = port; } - public BaseHttpServer(int port, bool ssl) + public BaseHttpServer(uint port, bool ssl) { m_ssl = ssl; m_port = port; diff --git a/OpenSim/Framework/UserConfig.cs b/OpenSim/Framework/UserConfig.cs index 1cc00c7..39b1599 100644 --- a/OpenSim/Framework/UserConfig.cs +++ b/OpenSim/Framework/UserConfig.cs @@ -76,7 +76,7 @@ namespace OpenSim.Framework configMember.addConfigurationOption("default_inventory_server", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default Inventory Server URI", - "http://127.0.0.1:8004/", false); + "http://127.0.0.1:" + InventoryConfig.DefaultHttpPort.ToString() + "/", false); configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs index 61427fa..c973f99 100644 --- a/OpenSim/Grid/AssetServer/Main.cs +++ b/OpenSim/Grid/AssetServer/Main.cs @@ -92,7 +92,7 @@ namespace OpenSim.Grid.AssetServer LoadDefaultAssets(); m_console.Verbose("ASSET", "Starting HTTP process"); - BaseHttpServer httpServer = new BaseHttpServer((int) m_config.HttpPort); + BaseHttpServer httpServer = new BaseHttpServer(m_config.HttpPort); httpServer.AddStreamHandler(new GetAssetStreamHandler(this, m_assetProvider)); httpServer.AddStreamHandler(new PostAssetStreamHandler(this, m_assetProvider)); diff --git a/OpenSim/Grid/GridServer/Main.cs b/OpenSim/Grid/GridServer/Main.cs index b793cf9..d6b30ce 100644 --- a/OpenSim/Grid/GridServer/Main.cs +++ b/OpenSim/Grid/GridServer/Main.cs @@ -112,7 +112,7 @@ namespace OpenSim.Grid.GridServer m_gridManager.config = Cfg; m_console.Verbose("GRID", "Starting HTTP process"); - BaseHttpServer httpServer = new BaseHttpServer((int) Cfg.HttpPort); + BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort); //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback); httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod); diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index d2ad6ae..74352ac 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs @@ -92,7 +92,7 @@ namespace OpenSim.Grid.UserServer m_loginService = new UserLoginService(m_userManager, Cfg, Cfg.DefaultStartupMsg); MainLog.Instance.Verbose("REGION", "Starting HTTP process"); - BaseHttpServer httpServer = new BaseHttpServer((int) Cfg.HttpPort); + BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort); httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod); diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs index ccd3548..f404cce 100644 --- a/OpenSim/Grid/UserServer/UserLoginService.cs +++ b/OpenSim/Grid/UserServer/UserLoginService.cs @@ -81,7 +81,7 @@ namespace OpenSim.Grid.UserServer MainLog.Instance.Verbose("LOGIN", "CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY); response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString(); - response.SimPort = (Int32)SimInfo.serverPort; + response.SimPort = (uint) SimInfo.serverPort; response.RegionX = SimInfo.regionLocX; response.RegionY = SimInfo.regionLocY; @@ -149,7 +149,7 @@ namespace OpenSim.Grid.UserServer MainLog.Instance.Verbose("LOGIN", "CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY); response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString(); - response.SimPort = (Int32)SimInfo.serverPort; + response.SimPort = (uint) SimInfo.serverPort; response.RegionX = SimInfo.regionLocX; response.RegionY = SimInfo.regionLocY; diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index 5b43fec..53ed2ab 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -49,7 +49,7 @@ namespace OpenSim.Region.ClientStack protected NetworkServersInfo m_networkServersInfo; protected BaseHttpServer m_httpServer; - protected int m_httpServerPort; + protected uint m_httpServerPort; protected LogBase m_log; protected CommunicationsManager m_commsManager; @@ -106,7 +106,7 @@ namespace OpenSim.Region.ClientStack protected Scene SetupScene(RegionInfo regionInfo, out UDPServer udpServer, bool m_permissions) { AgentCircuitManager circuitManager = new AgentCircuitManager(); - udpServer = new UDPServer(regionInfo.InternalEndPoint.Port, m_assetCache, m_log, circuitManager); + udpServer = new UDPServer((uint) regionInfo.InternalEndPoint.Port, m_assetCache, m_log, circuitManager); Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager); diff --git a/OpenSim/Region/ClientStack/UDPServer.cs b/OpenSim/Region/ClientStack/UDPServer.cs index b0586a3..aaf7224 100644 --- a/OpenSim/Region/ClientStack/UDPServer.cs +++ b/OpenSim/Region/ClientStack/UDPServer.cs @@ -49,7 +49,7 @@ namespace OpenSim.Region.ClientStack protected PacketServer m_packetServer; protected ulong m_regionHandle; - protected int listenPort; + protected uint listenPort; protected IScene m_localScene; protected AssetCache m_assetCache; protected LogBase m_log; @@ -83,7 +83,7 @@ namespace OpenSim.Region.ClientStack { } - public UDPServer(int port, AssetCache assetCache, LogBase console, AgentCircuitManager authenticateClass) + public UDPServer(uint port, AssetCache assetCache, LogBase console, AgentCircuitManager authenticateClass) { listenPort = port; m_assetCache = assetCache; @@ -180,9 +180,9 @@ namespace OpenSim.Region.ClientStack public void ServerListener() { - m_log.Verbose("SERVER", "Opening UDP socket on " + listenPort); + m_log.Verbose("SERVER", "Opening UDP socket on " + listenPort.ToString()); - ServerIncoming = new IPEndPoint(IPAddress.Parse("0.0.0.0"), listenPort); + ServerIncoming = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) listenPort); Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); Server.Bind(ServerIncoming); diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs index eef6ed4..103c76f 100644 --- a/OpenSim/Region/Communications/Local/LocalLoginService.cs +++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs @@ -121,11 +121,10 @@ namespace OpenSim.Region.Communications.Local theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; string capsPath = Util.GetRandomCapsPath(); response.SimAddress = reg.ExternalEndPoint.Address.ToString(); - response.SimPort = (Int32) reg.ExternalEndPoint.Port; + response.SimPort = (uint) reg.ExternalEndPoint.Port; response.RegionX = reg.RegionLocX; response.RegionY = reg.RegionLocY; - response.SeedCapability = "http://" + reg.ExternalHostName + ":" + serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/"; // response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CapsSeed/" + capsPath + "0000/"; diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index b11a91f..353dc28 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -166,7 +166,7 @@ namespace OpenSim.Region.Communications.OGS1 { string simIp = (string) neighbourData["sim_ip"]; - int port = Convert.ToInt32(neighbourData["sim_port"]); + uint port = Convert.ToUInt32(neighbourData["sim_port"]); string externalUri = (string) neighbourData["sim_uri"]; string externalIpStr = Util.GetHostFromDNS(simIp).ToString(); @@ -450,7 +450,7 @@ namespace OpenSim.Region.Communications.OGS1 /// private void StartRemoting() { - TcpChannel ch = new TcpChannel(NetworkServersInfo.RemotingListenerPort); + TcpChannel ch = new TcpChannel((int) NetworkServersInfo.RemotingListenerPort); ChannelServices.RegisterChannel(ch, false); // Disabled security as Mono doesnt support this. WellKnownServiceTypeEntry wellType = @@ -559,7 +559,7 @@ namespace OpenSim.Region.Communications.OGS1 // it's own remoting port! How special. region = new SearializableRegionInfo(RequestNeighbourInfo(region.RegionHandle)); region.RemotingAddress = region.ExternalHostName; - region.RemotingPort = (uint) NetworkServersInfo.RemotingListenerPort; + region.RemotingPort = NetworkServersInfo.RemotingListenerPort; if (m_localBackend.RegionUp(region,regionhandle)) { return true; diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs index be38baf..c93804f 100644 --- a/OpenSim/Region/Environment/Modules/ChatModule.cs +++ b/OpenSim/Region/Environment/Modules/ChatModule.cs @@ -265,7 +265,7 @@ namespace OpenSim.Region.Environment.Modules internal class IRCChatModule { private string m_server = null; - private int m_port = 6668; + private uint m_port = 6668; private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot"; private string m_nick = null; private string m_channel = null; @@ -296,7 +296,7 @@ namespace OpenSim.Region.Environment.Modules m_server = config.Configs["IRC"].GetString("server"); m_nick = config.Configs["IRC"].GetString("nick"); m_channel = config.Configs["IRC"].GetString("channel"); - m_port = config.Configs["IRC"].GetInt("port", m_port); + m_port = (uint) config.Configs["IRC"].GetInt("port", (int) m_port); m_user = config.Configs["IRC"].GetString("username", m_user); if (m_server != null && m_nick != null && m_channel != null) { @@ -316,7 +316,7 @@ namespace OpenSim.Region.Environment.Modules { m_scenes = scenes; - m_tcp = new TcpClient(m_server, m_port); + m_tcp = new TcpClient(m_server, (int) m_port); m_log.Verbose("IRC", "Connecting..."); m_stream = m_tcp.GetStream(); m_log.Verbose("IRC", "Connected to " + m_server); diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index 9e5ca9b..16dcd7b 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs @@ -90,7 +90,7 @@ namespace SimpleApp m_log.Notice(m_log.LineInfo); IPEndPoint internalEndPoint = - new IPEndPoint(IPAddress.Parse("127.0.0.1"), m_networkServersInfo.HttpListenerPort); + new IPEndPoint(IPAddress.Parse("127.0.0.1"), (int) m_networkServersInfo.HttpListenerPort); RegionInfo regionInfo = new RegionInfo(1000, 1000, internalEndPoint, "localhost"); regionInfo.DataStore = "simpleapp_datastore.yap"; -- cgit v1.1