From 362a71f445f218b1d54576989c88ad450c9e5905 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Sun, 7 Nov 2010 22:03:51 +0100 Subject: Add error argument to Connection::handle_read(). --- server/connection.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'server/connection.cpp') diff --git a/server/connection.cpp b/server/connection.cpp index f846d3b..32b24da 100644 --- a/server/connection.cpp +++ b/server/connection.cpp @@ -6,7 +6,11 @@ Connection::Connection(boost::asio::io_service& io_service) : socket(io_service) } -void Connection::handle_read(uint8_t* data, std::size_t bytes) { +void Connection::handle_read(uint8_t* data, std::size_t bytes, const boost::system::error_code& error) { + if(error) { + return; + } + got_data(data, bytes); delete[] data; @@ -20,7 +24,7 @@ void Connection::request_data(std::size_t bytes) { uint8_t* buf = new uint8_t[bytes]; boost::asio::async_read(socket, boost::asio::buffer(buf, bytes), - boost::bind(&Connection::handle_read, shared_from_this(), buf, bytes)); + boost::bind(&Connection::handle_read, shared_from_this(), buf, bytes, boost::asio::placeholders::error)); // boost::asio::placeholders::error } -- cgit v1.2.3