sources/network/rconsession.cpp

changeset 24
e651d02802c0
parent 23
f7221183a994
child 25
88b41eea08e0
--- a/sources/network/rconsession.cpp	Sun Dec 14 20:47:44 2014 +0200
+++ b/sources/network/rconsession.cpp	Sun Dec 14 23:21:38 2014 +0200
@@ -16,13 +16,24 @@
 	}
 
 	g_rconSession = this;
+}
 
-	if (not m_socket.set_blocking (false))
+// -------------------------------------------------------------------------------------------------
+//
+STATIC METHOD
+RCONSession::new_session() -> RCONSession*
+{
+	RCONSession* session = new RCONSession;
+
+	if (not session->socket()->set_blocking (false))
 	{
-		// TODO: find a better way to deal with errors
 		print ("unable to set socket as non-blocking: %s\n",
-			m_socket.error_string().chars());
+			session->socket()->error_string().chars());
+		delete session;
+		return nullptr;
 	}
+
+	return session;
 }
 
 // -------------------------------------------------------------------------------------------------
@@ -275,3 +286,11 @@
 	bump_last_ping();
 	return true;
 }
+
+// -------------------------------------------------------------------------------------------------
+//
+METHOD
+RCONSession::state() const -> RCONSessionState
+{
+	return m_state;
+}

mercurial