From e3490d65bb824a9b4ee0fdc0872753fa295b1087 Mon Sep 17 00:00:00 2001 From: Oleg Morozenkov Date: Wed, 12 Aug 2015 13:43:02 +0300 Subject: Fix some compiler errors with global header file --- include/tgbot/net/HttpServer.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'include/tgbot/net/HttpServer.h') diff --git a/include/tgbot/net/HttpServer.h b/include/tgbot/net/HttpServer.h index bac7382..888c0a8 100644 --- a/include/tgbot/net/HttpServer.h +++ b/include/tgbot/net/HttpServer.h @@ -38,22 +38,22 @@ namespace TgBot { template class HttpServer { -private: +protected: class Connection; public: typedef std::function)> ServerHandler; - HttpServer(std::shared_ptr>& acceptor, const ServerHandler& handler) : _acceptor(acceptor), _handler(handler) { + HttpServer(std::shared_ptr> acceptor, const ServerHandler& handler) : _acceptor(acceptor), _handler(handler) { } /** * Starts receiving new connections. */ void start() { - std::shared_ptr> socket(new boost::asio::basic_stream_socket(acceptor->get_io_service())); - std::shared_ptr> connection(new Connection(socket, _handler)); - acceptor->async_accept(*connection->socket, [this, connection]() { + std::shared_ptr> socket(new boost::asio::basic_stream_socket(_acceptor->get_io_service())); + std::shared_ptr connection(new Connection(socket, _handler)); + _acceptor->async_accept(*connection->socket, [this, connection]() { connection->start(); start(); }); @@ -67,8 +67,7 @@ public: _ioService.stop(); } -private: - template +protected: class Connection { public: @@ -89,7 +88,7 @@ private: std::shared_ptr> socket; std::string data; - private: + protected: const ServerHandler _handler; }; -- cgit v1.2.3