efl_io_buffered_stream: eos-mark and flush sender on close.

By marking EOS on the outgoing queue we allow the sender to flush
pending data if that's possible.

This also fixes a typo in the condition for eos_mark, it operates on
outgoing, not incoming queue.
This commit is contained in:
Gustavo Sverzut Barbieri 2016-12-20 10:11:21 -02:00
parent c152aad8c5
commit fd6dbe3393
1 changed files with 7 additions and 1 deletions

View File

@ -192,6 +192,12 @@ _efl_io_buffered_stream_efl_io_closer_close(Eo *o, Efl_Io_Buffered_Stream_Data *
EINA_SAFETY_ON_TRUE_RETURN_VAL(pd->closed, EINVAL);
if (pd->outgoing)
{
efl_io_queue_eos_mark(pd->outgoing);
efl_io_copier_flush(pd->sender, EINA_FALSE, EINA_TRUE);
}
/* line delimiters may be holding a last chunk of data */
if (pd->receiver) efl_io_copier_flush(pd->receiver, EINA_FALSE, EINA_TRUE);
@ -561,7 +567,7 @@ _efl_io_buffered_stream_clear(Eo *o EINA_UNUSED, Efl_Io_Buffered_Stream_Data *pd
EOLIAN static void
_efl_io_buffered_stream_eos_mark(Eo *o, Efl_Io_Buffered_Stream_Data *pd)
{
if (!pd->incoming) return;
if (!pd->outgoing) return;
DBG("%p mark eos", o);
efl_io_queue_eos_mark(pd->outgoing);
}