--- a/sources/network/rconsession.cpp Tue Dec 16 01:46:22 2014 +0200 +++ b/sources/network/rconsession.cpp Tue Dec 16 02:30:31 2014 +0200 @@ -8,7 +8,12 @@ RCONSession::RCONSession() : m_state (RCON_DISCONNECTED), m_lastPing (0), - m_numAdmins (0) + m_numAdmins (0) {} + +// ------------------------------------------------------------------------------------------------- +// +STATIC METHOD +RCONSession::new_session() -> RCONSession* { if (g_rconSession != NULL) { @@ -16,25 +21,17 @@ delete g_rconSession; } - g_rconSession = this; -} + g_rconSession = new RCONSession; -// ------------------------------------------------------------------------------------------------- -// -STATIC METHOD -RCONSession::new_session() -> RCONSession* -{ - RCONSession* session = new RCONSession; - - if (not session->socket()->set_blocking (false)) + if (not g_rconSession->socket()->set_blocking (false)) { print ("unable to set socket as non-blocking: %s\n", - session->socket()->error_string().chars()); - delete session; + g_rconSession->socket()->error_string().chars()); + delete g_rconSession; return nullptr; } - return session; + return g_rconSession; } // ------------------------------------------------------------------------------------------------- @@ -55,6 +52,7 @@ m_address = address; m_state = RCON_CONNECTING; Interface::update_statusbar(); + send_hello(); } // -------------------------------------------------------------------------------------------------