From 6f51fbfb06767000173647b57d0b755f4d02c247 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Mon, 15 Nov 2010 07:02:48 +0100 Subject: Added Lobby class to server, serving as the master application class. --- server/tcpserver.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'server/tcpserver.cpp') diff --git a/server/tcpserver.cpp b/server/tcpserver.cpp index 545e666..3f34997 100644 --- a/server/tcpserver.cpp +++ b/server/tcpserver.cpp @@ -6,7 +6,7 @@ TCPServer::TCPServer(boost::asio::io_service& io_service) : acceptor_(io_service, boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), 12345)) { // Start listening for first connection attempt. - listen(); + //listen(); } void TCPServer::listen() { @@ -16,19 +16,17 @@ void TCPServer::listen() { boost::bind(&TCPServer::handle_connection, this, new_connection, boost::asio::placeholders::error)); } - -//! Incoming connection, handle void TCPServer::handle_connection(Connection::p connection, const boost::system::error_code& error) { if(error) { return; } - connection->connected(); - - Message::p m = make_shared("aotenjoud git"); - - connection->send(m); + connect_callback(connection); +} + +void TCPServer::get_connection(boost::function f) { + connect_callback = f; - // Start listening for another connection attempt. + // Start listening for a connection attempt. listen(); } -- cgit v1.2.3