diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2012-04-05 05:46:32 +0200 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2012-04-06 12:41:08 +0200 |
commit | 8c9595effe514068c8f051b06636ab6b5cf7e67a (patch) | |
tree | 4eda8360cbf2d929bcadff911250bd0bcfd5bd2b | |
parent | 91267446ef621adfa35c9f90df7754ecf5299e4d (diff) |
Allow pipe_t::flush() to be called from pipe_t::terminate()
Previous patch have broken flushing a delimiter in pipe_t::terminate()
function. This patch allows the flush to happen even if pipe state
is set to 'terminated'.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
-rw-r--r-- | src/pipe.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/pipe.cpp b/src/pipe.cpp index 77893d2..0a15cc0 100644 --- a/src/pipe.cpp +++ b/src/pipe.cpp @@ -346,9 +346,9 @@ void xs::pipe_t::terminate (bool delay_) // There are still pending messages available, but the user calls // 'terminate'. We can act as if all the pending messages were read. else if (state == pending && !delay) { - outpipe = NULL; - send_pipe_term_ack (peer); - state = terminating; + outpipe = NULL; + send_pipe_term_ack (peer); + state = terminating; } // If there are pending messages still availabe, do nothing. @@ -381,7 +381,8 @@ void xs::pipe_t::terminate (bool delay_) msg_t msg; msg.init_delimiter (); outpipe->write (msg, false); - flush (); + if (state != terminating && !outpipe->flush ()) + send_activate_read (peer); } } |