fixed issue when end-of-file was encountered, this fixes #266
This commit is contained in:
parent
53f994d61d
commit
d2e3792abc
|
|
@ -86,7 +86,7 @@ public:
|
||||||
* Return 0 if you want to disable heartbeats.
|
* Return 0 if you want to disable heartbeats.
|
||||||
*
|
*
|
||||||
* If heartbeats are enabled, you yourself are responsible to send
|
* 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.
|
* the Connection::heartbeat() method.
|
||||||
*
|
*
|
||||||
* @param connection The connection that suggested a heartbeat interval
|
* @param connection The connection that suggested a heartbeat interval
|
||||||
|
|
|
||||||
|
|
@ -151,10 +151,8 @@ public:
|
||||||
// read data from buffer
|
// read data from buffer
|
||||||
ssize_t result = _in.receivefrom(_socket, _parent->expected());
|
ssize_t result = _in.receivefrom(_socket, _parent->expected());
|
||||||
|
|
||||||
// are we in an error state?
|
// did we encounter end-of-file or are we in an error state?
|
||||||
if (result < 0 && reportError()) return finalState(monitor);
|
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"
|
// 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
|
// object gets destructed halfway through the call to the parse() method
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue