reformatted source code

This commit is contained in:
Kjistóf 2016-12-03 13:22:51 +01:00
parent 75f77766c1
commit b42aa09286

View File

@ -18,14 +18,14 @@ namespace chat
class client_network_manager class client_network_manager
{ {
private: private:
std::string _login;
asio::io_service& _ios; asio::io_service& _ios;
tcp::socket _socket; tcp::socket _socket;
asio::streambuf _isb; asio::streambuf _isb;//<-------.
asio::streambuf _osb; asio::streambuf _osb;//<---. |
std::istream _is; std::istream _is;//--------|---'
std::ostream _os; std::ostream _os;//--------'
std::string _login;
static void throw_if_error(boost::system::error_code& ec) static void throw_if_error(boost::system::error_code& ec)
@ -77,15 +77,21 @@ namespace chat
}); });
} }
void connect(boost::asio::ip::tcp::resolver::iterator epit) void connect(tcp::resolver::iterator epit)
{ {
asio::async_connect(_socket, epit, asio::async_connect
std::bind(&client_network_manager::handshake, this, std::placeholders::_1, (
std::placeholders::_2)); _socket, epit,
std::bind(&client_network_manager::handshake,
this, std::placeholders::_1,
std::placeholders::_2)
);
} }
public: public:
client_network_manager(asio::io_service& ioservice, tcp::resolver::iterator epit, std::string login) client_network_manager(asio::io_service& ioservice,
tcp::resolver::iterator epit,
std::string login)
: _ios(ioservice), _socket(_ios), _isb(), _osb(), _is(&_isb), _os(&_osb), _login(login) : _ios(ioservice), _socket(_ios), _isb(), _osb(), _is(&_isb), _os(&_osb), _login(login)
{ connect(epit); } { connect(epit); }
@ -93,7 +99,8 @@ namespace chat
{ {
_ios.post([this, message] _ios.post([this, message]
{ {
asio::async_write(_socket, asio::buffer(message.get()), [](boost::system::error_code, size_t) asio::async_write(_socket, asio::buffer(message.get()),
[](boost::system::error_code, size_t)
{}); {});
}); });
} }