fixed a bug, where messages would only be read till whitespaces

This commit is contained in:
2016-12-04 14:31:26 +01:00
parent 09c2dafba5
commit ab4a102bad
3 changed files with 44 additions and 7 deletions

View File

@ -16,12 +16,15 @@ namespace chat
using boost::asio::ip::tcp;
template <class receive_policy>
template <class receive_policy, class send_policy>
class client_network_manager
{
/* compile-time check for whether receive_policy is valid or not */
static_assert(is_valid_policy<receive_policy>::value,
/* compile-time checks for whether policies are valid or not */
static_assert(is_valid_receive_policy<receive_policy>::value,
"Receive policy does not supply neccessary methods!");
static_assert(is_valid_send_policy<send_policy>::value,
"Send policy does not supply neccessary methods!");
/* members */
private:
@ -45,6 +48,9 @@ namespace chat
void send(chat_message message)
{
if (!send_policy::check_msg_length(message))
return;
_ios.post([this, message]
{
asio::async_write(_socket, asio::buffer(message.get()),