Before this patch, the stream engine terminated itself
whenever it had detected an IO error. If this happened
when sending a message, the engine lost all
in-flight messages, messages waiting to be decoded,
and the last decoded message that had not been accepted,
if there was one.

The new behaviour is to terminate the engine only after
the input error has been detected and the last decoded
This commit is contained in:
Martin Hurton
2012-04-29 17:13:18 +02:00
parent 16ec2868c5
commit 776563fcff
4 changed files with 45 additions and 11 deletions

View File

@@ -52,9 +52,9 @@ namespace zmq
public:
inline decoder_base_t (size_t bufsize_) :
next (NULL),
read_pos (NULL),
to_read (0),
next (NULL),
bufsize (bufsize_)
{
buf = (unsigned char*) malloc (bufsize_);
@@ -165,6 +165,11 @@ namespace zmq
next = NULL;
}
// Next step. If set to NULL, it means that associated data stream
// is dead. Note that there can be still data in the process in such
// case.
step_t next;
private:
// Where to store the read data.
@@ -173,11 +178,6 @@ namespace zmq
// How much data to read before taking next step.
size_t to_read;
// Next step. If set to NULL, it means that associated data stream
// is dead. Note that there can be still data in the process in such
// case.
step_t next;
// The duffer for data to decode.
size_t bufsize;
unsigned char *buf;
@@ -197,6 +197,10 @@ namespace zmq
void set_session (zmq::session_base_t *session_);
// Returns true if there is a decoded message
// waiting to be delivered to the session.
bool stalled () const;
private:
bool one_byte_size_ready ();