summaryrefslogtreecommitdiff
path: root/server/tcpserver.cpp
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2010-11-15 07:02:48 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2010-11-15 07:02:48 +0100
commit6f51fbfb06767000173647b57d0b755f4d02c247 (patch)
tree18c2f348c0bf0225f5b2e3e5343a4b54a420fbda /server/tcpserver.cpp
parent174ac25d9788e5604ae37cf9048e307a97bbdff8 (diff)
Added Lobby class to server, serving as the master application class.
Diffstat (limited to 'server/tcpserver.cpp')
-rw-r--r--server/tcpserver.cpp16
1 files changed, 7 insertions, 9 deletions
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<Message::Hello>("aotenjoud git");
-
- connection->send(m);
+ connect_callback(connection);
+}
+
+void TCPServer::get_connection(boost::function<void (Connection::p)> f) {
+ connect_callback = f;
- // Start listening for another connection attempt.
+ // Start listening for a connection attempt.
listen();
}