Jelajahi Sumber

Do not store port number

Daniele Bartolini 12 tahun lalu
induk
melakukan
49822b0e80
3 mengubah file dengan 6 tambahan dan 16 penghapusan
  1. 2 8
      engine/ConsoleServer.cpp
  2. 2 6
      engine/ConsoleServer.h
  3. 2 2
      engine/Device.cpp

+ 2 - 8
engine/ConsoleServer.cpp

@@ -40,15 +40,9 @@ namespace crown
 {
 
 //-----------------------------------------------------------------------------
-ConsoleServer::ConsoleServer(uint16_t port)
-	: m_port(port)
+void ConsoleServer::init(uint16_t port, bool wait)
 {
-}
-
-//-----------------------------------------------------------------------------
-void ConsoleServer::init(bool wait)
-{
-	m_server.open(m_port);
+	m_server.open(port);
 	m_server.listen(5);
 
 	if (wait)

+ 2 - 6
engine/ConsoleServer.h

@@ -53,12 +53,9 @@ class ConsoleServer
 {
 public:
 
-	/// Listens on the given @a port.
-								ConsoleServer(uint16_t port);
-
-	/// Initializes the system. If @a wait is true, this function
+	/// Listens on the given @a port. If @a wait is true, this function
 	/// blocks until a client is connected.
-	void						init(bool wait);
+	void						init(uint16_t port, bool wait);
 	void						shutdown();
 
 	void						log_to_all(const char* message, LogSeverity::Enum severity);
@@ -83,7 +80,6 @@ private:
 
 private:
 
-	uint16_t					m_port;
 	TCPServer					m_server;
 	ClientArray					m_clients;
 };

+ 2 - 2
engine/Device.cpp

@@ -121,8 +121,8 @@ void Device::init()
 
 	// RPC only in debug or development builds
 	#if defined(CROWN_DEBUG) || defined(CROWN_DEVELOPMENT)
-		m_console = CE_NEW(m_allocator, ConsoleServer)(m_console_port);
-		m_console->init(false);
+		m_console = CE_NEW(m_allocator, ConsoleServer)();
+		m_console->init(m_console_port, false);
 	#endif
 
 	Log::d("Creating filesystem...");