From 2ecb637f0c4a97643962d1703f208d1b1baf7e9b Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Sat, 21 Dec 2013 21:04:31 +0100 Subject: Read a variable number of bytes, 4096 by default --- src/network/socket_handler.cpp | 4 ++-- src/network/socket_handler.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/network/socket_handler.cpp b/src/network/socket_handler.cpp index 246d8d3..e3973f1 100644 --- a/src/network/socket_handler.cpp +++ b/src/network/socket_handler.cpp @@ -61,11 +61,11 @@ void SocketHandler::set_poller(Poller* poller) this->poller = poller; } -void SocketHandler::on_recv() +void SocketHandler::on_recv(const size_t nb) { char buf[4096]; - ssize_t size = ::recv(this->socket, buf, 4096, 0); + ssize_t size = ::recv(this->socket, buf, nb, 0); if (0 == size) { this->on_connection_close(); diff --git a/src/network/socket_handler.hpp b/src/network/socket_handler.hpp index 4152a4e..6678722 100644 --- a/src/network/socket_handler.hpp +++ b/src/network/socket_handler.hpp @@ -30,7 +30,7 @@ public: * Reads data in our in_buf and the call parse_in_buf, for the implementor * to handle the data received so far. */ - void on_recv(); + void on_recv(const size_t nb = 4096); /** * Write as much data from out_buf as possible, in the socket. */ -- cgit v1.2.3