reformatted source code
This commit is contained in:
parent
75f77766c1
commit
b42aa09286
@ -18,14 +18,14 @@ namespace chat
|
||||
class client_network_manager
|
||||
{
|
||||
private:
|
||||
std::string _login;
|
||||
|
||||
asio::io_service& _ios;
|
||||
tcp::socket _socket;
|
||||
asio::streambuf _isb;
|
||||
asio::streambuf _osb;
|
||||
std::istream _is;
|
||||
std::ostream _os;
|
||||
asio::streambuf _isb;//<-------.
|
||||
asio::streambuf _osb;//<---. |
|
||||
std::istream _is;//--------|---'
|
||||
std::ostream _os;//--------'
|
||||
|
||||
std::string _login;
|
||||
|
||||
|
||||
static void throw_if_error(boost::system::error_code& ec)
|
||||
@ -77,24 +77,31 @@ namespace chat
|
||||
});
|
||||
}
|
||||
|
||||
void connect(boost::asio::ip::tcp::resolver::iterator epit)
|
||||
void connect(tcp::resolver::iterator epit)
|
||||
{
|
||||
asio::async_connect(_socket, epit,
|
||||
std::bind(&client_network_manager::handshake, this, std::placeholders::_1,
|
||||
std::placeholders::_2));
|
||||
asio::async_connect
|
||||
(
|
||||
_socket, epit,
|
||||
std::bind(&client_network_manager::handshake,
|
||||
this, std::placeholders::_1,
|
||||
std::placeholders::_2)
|
||||
);
|
||||
}
|
||||
|
||||
public:
|
||||
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)
|
||||
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)
|
||||
{ connect(epit); }
|
||||
|
||||
void send(chat_message 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)
|
||||
{});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user