ecore_con/ecore_ipc: flush should wait for connection.

Some applications will create the handle, immediately send data, flush
and delete it, expecting the data to be sent to remote peer.

This is a bad behavior as the application would become unresponsive
until the connection is established, data can be written (since
depends on server consuming it), then allow it to be closed.

A proper behavior here would be to chain based on events, with the
usage of a copier would be simply wait for "done" event.

However the legacy API allowed this and terminology depends on this
awkward "feature", thus be bug-compatible.

This fixes T5015.
This commit is contained in:
Gustavo Sverzut Barbieri 2016-12-19 12:57:09 -02:00
parent fe668ef52c
commit a7657e821f
2 changed files with 7 additions and 0 deletions

View File

@ -2262,6 +2262,10 @@ ecore_con_server_flush(Ecore_Con_Server *svr)
if (!svr->dialer) return;
while (!efl_io_closer_closed_get(svr->dialer) &&
!efl_net_dialer_connected_get(svr->dialer))
ecore_main_loop_iterate();
efl_io_buffered_stream_flush(svr->dialer, EINA_FALSE, EINA_TRUE);
inner_dialer = efl_io_buffered_stream_inner_io_get(svr->dialer);

View File

@ -1182,6 +1182,9 @@ ecore_ipc_server_flush(Ecore_Ipc_Server *svr)
}
if (svr->dialer.input)
{
while (!efl_io_closer_closed_get(svr->dialer.dialer) &&
!efl_net_dialer_connected_get(svr->dialer.dialer))
ecore_main_loop_iterate();
while (efl_io_queue_usage_get(svr->dialer.input) > 0)
efl_io_copier_flush(svr->dialer.send_copier, EINA_TRUE, EINA_TRUE);
return;