diff --git a/util/socket.cpp b/util/socket.cpp index ed669e75..e751b097 100644 --- a/util/socket.cpp +++ b/util/socket.cpp @@ -222,9 +222,10 @@ std::string Socket::Connection::getStats(std::string C){ } /// Updates the downbuffer and upbuffer internal variables. -void Socket::Connection::spool(){ - iread(downbuffer); +/// Returns true if new data was received, false otherwise. +bool Socket::Connection::spool(){ iwrite(upbuffer); + return iread(downbuffer); } /// Returns a reference to the download buffer. diff --git a/util/socket.h b/util/socket.h index 988b96c2..3a538286 100644 --- a/util/socket.h +++ b/util/socket.h @@ -48,7 +48,7 @@ namespace Socket{ bool swrite(std::string & buffer); ///< Write call that is compatible with std::string. bool iread(std::string & buffer); ///< Incremental write call that is compatible with std::string. bool iwrite(std::string & buffer); ///< Write call that is compatible with std::string. - void spool(); ///< Updates the downbuffer and upbuffer internal variables. + bool spool(); ///< Updates the downbuffer and upbuffer internal variables. std::string & Received(); ///< Returns a reference to the download buffer. void Send(std::string data); ///< Appends data to the upbuffer. void close(); ///< Close connection.