aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2017-03-27 10:53:43 -0300
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>2017-03-27 16:14:52 -0300
commitd60809e700628b17dfad21d91d885ae009009e0e (patch)
treee2a8c0490abe6bfd577e2cf152cb3fb1a6c95dee
parentecore pub headers - use __sun not __sun__ for ifdef for solaris (diff)
downloadefl-d60809e700628b17dfad21d91d885ae009009e0e.tar.gz
efl_net_dialer_unix_example: read in loop while "can_read".
While in UNIX we use 'select()/poll()' to query for read fds and this will eventually callback with "can_read" event, use the loop to match other implementations where can_read keeps true if not all data was read.
-rw-r--r--src/examples/ecore/efl_net_dialer_unix_example.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/examples/ecore/efl_net_dialer_unix_example.c b/src/examples/ecore/efl_net_dialer_unix_example.c
index 57110ef76e..e890a3a21f 100644
--- a/src/examples/ecore/efl_net_dialer_unix_example.c
+++ b/src/examples/ecore/efl_net_dialer_unix_example.c
@@ -33,7 +33,6 @@ static void
_can_read(void *data EINA_UNUSED, const Efl_Event *event)
{
char buf[4];
- Eina_Rw_Slice rw_slice = EINA_SLICE_ARRAY(buf);
Eina_Error err;
Eina_Bool can_read = efl_io_reader_can_read_get(event->object);
@@ -45,16 +44,23 @@ _can_read(void *data EINA_UNUSED, const Efl_Event *event)
if (!can_read) return;
if (!do_read) return;
- err = efl_io_reader_read(event->object, &rw_slice);
- if (err)
+ do
{
- fprintf(stderr, "ERROR: could not read: %s\n", eina_error_msg_get(err));
- retval = EXIT_FAILURE;
- ecore_main_loop_quit();
- return;
+ Eina_Rw_Slice rw_slice = EINA_SLICE_ARRAY(buf);
+
+ err = efl_io_reader_read(event->object, &rw_slice);
+ if (err)
+ {
+ if (err == EAGAIN) return;
+ fprintf(stderr, "ERROR: could not read: %s\n", eina_error_msg_get(err));
+ retval = EXIT_FAILURE;
+ ecore_main_loop_quit();
+ return;
+ }
+
+ fprintf(stderr, "INFO: read '" EINA_SLICE_STR_FMT "'\n", EINA_SLICE_STR_PRINT(rw_slice));
}
-
- fprintf(stderr, "INFO: read '" EINA_SLICE_STR_FMT "'\n", EINA_SLICE_STR_PRINT(rw_slice));
+ while (efl_io_reader_can_read_get(event->object));
}
static void