summaryrefslogtreecommitdiff
path: root/server/connection.h
diff options
context:
space:
mode:
Diffstat (limited to 'server/connection.h')
-rw-r--r--server/connection.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/server/connection.h b/server/connection.h
index b6a3cd3..3428b88 100644
--- a/server/connection.h
+++ b/server/connection.h
@@ -3,6 +3,7 @@
#include <boost/asio.hpp>
#include <boost/enable_shared_from_this.hpp>
+#include <boost/function.hpp>
#include "../common/connectionbase.h"
@@ -12,6 +13,8 @@ class Connection : public ConnectionBase, public boost::enable_shared_from_this<
boost::asio::ip::tcp::socket socket;
+ boost::function<void (Message::p)> recv_callback;
+
Connection(boost::asio::io_service& io_service);
//! Callback for when data is read.
@@ -26,12 +29,18 @@ class Connection : public ConnectionBase, public boost::enable_shared_from_this<
//! Implements write_data().
virtual void write_data(uint8_t* data, std::size_t bytes);
+
+ //! Implements got_message().
+ virtual void got_message(const Message::p& msg);
public:
typedef boost::shared_ptr<Connection> p;
//! Constructs a new instance and returns a shared pointer.
static p create(boost::asio::io_service& io_service);
+
+ //! Initiates an asynchronous message receive.
+ void recv(boost::function<void (Message::p)> f);
};
#endif