Fix a bug in pipe_t::flush().

Static analysis says:
src\pipe.cpp(193): error V547: Expression is always false. Probably the '||' operator should be used here.

If flush() is called on a pipe whose state was
"terminated" or "double_terminated", the programmer's
intent was to return immediately. But in fact the
two conditions can never be true simultaneously, so
the early return never happens, and we may try to flush
a terminated pipe anyway.
This commit is contained in:
Arthur O'Dwyer 2012-08-24 16:35:14 -07:00
parent 0886b7a26b
commit 6347d392fd

View File

@ -190,7 +190,7 @@ void zmq::pipe_t::rollback ()
void zmq::pipe_t::flush ()
{
// If terminate() was already called do nothing.
if (state == terminated && state == double_terminated)
if (state == terminated || state == double_terminated)
return;
// The peer does not exist anymore at this point.