diff options
author | Vegard Storheil Eriksen <zyp@jvnv.net> | 2010-12-25 12:54:59 +0100 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2010-12-25 12:54:59 +0100 |
commit | fae209a9e93400c3a2072befda9c820634cf9278 (patch) | |
tree | 2d69e2c75fff0e08468c168f773abbc939a2ff03 /server/tcpserver.cpp | |
parent | 94a1189d757f0269ac081ad2d750152e30564986 (diff) |
Diffstat (limited to 'server/tcpserver.cpp')
-rw-r--r-- | server/tcpserver.cpp | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/server/tcpserver.cpp b/server/tcpserver.cpp deleted file mode 100644 index 3f34997..0000000 --- a/server/tcpserver.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "tcpserver.h" - -#include <boost/bind.hpp> - -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(); -} - -void TCPServer::listen() { - Connection::p new_connection = Connection::create(acceptor_.io_service()); - - acceptor_.async_accept(new_connection->socket, - boost::bind(&TCPServer::handle_connection, this, new_connection, boost::asio::placeholders::error)); -} - -void TCPServer::handle_connection(Connection::p connection, const boost::system::error_code& error) { - if(error) { - return; - } - - connect_callback(connection); -} - -void TCPServer::get_connection(boost::function<void (Connection::p)> f) { - connect_callback = f; - - // Start listening for a connection attempt. - listen(); -} |