diff --git a/include/amqpcpp/connectionhandler.h b/include/amqpcpp/connectionhandler.h index fb3532d..ceceb25 100644 --- a/include/amqpcpp/connectionhandler.h +++ b/include/amqpcpp/connectionhandler.h @@ -86,7 +86,7 @@ public: * Return 0 if you want to disable heartbeats. * * If heartbeats are enabled, you yourself are responsible to send - * out a heartbeat every *interval* number of seconds by calling + * out a heartbeat every *interval / 2* number of seconds by calling * the Connection::heartbeat() method. * * @param connection The connection that suggested a heartbeat interval diff --git a/src/linux_tcp/tcpconnected.h b/src/linux_tcp/tcpconnected.h index e78dc23..3030df4 100644 --- a/src/linux_tcp/tcpconnected.h +++ b/src/linux_tcp/tcpconnected.h @@ -151,11 +151,9 @@ public: // read data from buffer ssize_t result = _in.receivefrom(_socket, _parent->expected()); - // are we in an error state? - if (result < 0 && reportError()) return finalState(monitor); + // did we encounter end-of-file or are we in an error state? + if (result == 0 || (result < 0 && reportError())) return finalState(monitor); - // @todo should we also check for result == 0 - // we need a local copy of the buffer - because it is possible that "this" // object gets destructed halfway through the call to the parse() method TcpInBuffer buffer(std::move(_in));