Resolve LIBZMQ-465

This commit is contained in:
Martin Hurton
2012-11-10 23:05:10 +01:00
parent 99f714445f
commit c543b2ce8c
9 changed files with 35 additions and 28 deletions

View File

@@ -143,6 +143,22 @@ namespace zmq
}
}
// Returns true if the decoder has been fed all required data
// but cannot proceed with the next decoding step.
// False is returned if the decoder has encountered an error.
bool stalled ()
{
while (!to_read) {
if (!(static_cast <T*> (this)->*next) ()) {
if (unlikely (!(static_cast <T*> (this)->next)))
return false;
return true;
}
}
return false;
}
inline bool message_ready_size (size_t msg_sz)
{
zmq_assert (false);
@@ -172,13 +188,13 @@ namespace zmq
next = NULL;
}
private:
// 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.
unsigned char *read_pos;
@@ -205,10 +221,6 @@ namespace zmq
// Set the receiver of decoded messages.
void set_msg_sink (i_msg_sink *msg_sink_);
// Returns true if there is a decoded message
// waiting to be delivered to the session.
bool stalled () const;
private:
bool one_byte_size_ready ();