summaryrefslogtreecommitdiff
path: root/server/connection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'server/connection.cpp')
-rw-r--r--server/connection.cpp8
1 files changed, 6 insertions, 2 deletions
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
}