From 174ac25d9788e5604ae37cf9048e307a97bbdff8 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Mon, 15 Nov 2010 07:01:56 +0100 Subject: Connection API changes. --- server/connection.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'server/connection.h') 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 #include +#include #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 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 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 f); }; #endif -- cgit v1.2.3