Fixes assertion on pipe.cpp:237 when swap fills up.

Fixes swap::full () functionality

Signed-off-by: Mikko Koppanen <mkoppanen@php.net>
This commit is contained in:
Mikko Koppanen
2010-12-15 20:10:27 +01:00
committed by Martin Sustrik
parent a46980babe
commit 27e83cc525
6 changed files with 39 additions and 12 deletions

View File

@@ -200,15 +200,15 @@ void zmq::writer_t::set_event_sink (i_writer_events *sink_)
sink = sink_;
}
bool zmq::writer_t::check_write ()
bool zmq::writer_t::check_write (zmq_msg_t *msg_)
{
// We've already checked and there's no space free for the new message.
// There's no point in checking once again.
if (unlikely (!active))
return false;
if (unlikely (swapping)) {
if (unlikely (swap->full ())) {
if (unlikely (!swap->fits (msg_))) {
active = false;
return false;
}
@@ -229,7 +229,7 @@ bool zmq::writer_t::check_write ()
bool zmq::writer_t::write (zmq_msg_t *msg_)
{
if (unlikely (!check_write ()))
if (unlikely (!check_write (msg_)))
return false;
if (unlikely (swapping)) {