barbieri pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=3bc7c502dbe039d59a11b740b73169775ce0702b

commit 3bc7c502dbe039d59a11b740b73169775ce0702b
Author: Gustavo Sverzut Barbieri <barbi...@profusion.mobi>
Date:   Wed Nov 23 02:43:38 2016 -0200

    ecore_ipc_server_example: test "write & del" using -m/--single-message
    
    An use case is to send some message and delete the handle, all data
    should be sent to client.
---
 src/examples/ecore/ecore_ipc_server_example.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/examples/ecore/ecore_ipc_server_example.c 
b/src/examples/ecore/ecore_ipc_server_example.c
index 1f3ed11..cbbdd66 100644
--- a/src/examples/ecore/ecore_ipc_server_example.c
+++ b/src/examples/ecore/ecore_ipc_server_example.c
@@ -6,6 +6,7 @@ static int retval = EXIT_SUCCESS;
 static int max_size = -1;
 static Eina_Bool echo = EINA_FALSE;
 static Eina_Bool do_flush = EINA_FALSE;
+static Eina_Bool single_message = EINA_FALSE;
 
 static Eina_Bool
 _client_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
@@ -21,6 +22,7 @@ _client_add(void *data EINA_UNUSED, int type EINA_UNUSED, 
void *event)
         ecore_ipc_client_send(ev->client, 1, 2, 3, 0, EINA_TRUE,
                               "Hello World!", strlen("Hello World!"));
         if (do_flush) ecore_ipc_client_flush(ev->client);
+        if (single_message) ecore_ipc_client_del(ev->client);
      }
 
    return ECORE_CALLBACK_RENEW;
@@ -60,6 +62,7 @@ _client_data(void *data EINA_UNUSED, int type EINA_UNUSED, 
void *event)
                               ev->ref + 1,
                               ev->ref, 0, ev->data, ev->size);
         if (do_flush) ecore_ipc_client_flush(ev->client);
+        if (single_message) ecore_ipc_client_del(ev->client);
      }
 
    return ECORE_CALLBACK_RENEW;
@@ -95,6 +98,7 @@ static const Ecore_Getopt options = {
     ECORE_GETOPT_STORE_TRUE('e', "echo",
                             "Behave as 'echo' server, send back to client all 
the data receive"),
     ECORE_GETOPT_STORE_TRUE('f', "flush", "Force a flush after every send 
call."),
+    ECORE_GETOPT_STORE_TRUE('m', "single-message", "Send a single message and 
delete the client."),
 
     ECORE_GETOPT_VERSION('V', "version"),
     ECORE_GETOPT_COPYRIGHT('C', "copyright"),
@@ -130,6 +134,7 @@ main(int argc, char **argv)
 
      ECORE_GETOPT_VALUE_BOOL(echo),
      ECORE_GETOPT_VALUE_BOOL(do_flush),
+     ECORE_GETOPT_VALUE_BOOL(single_message),
 
      /* standard block to provide version, copyright, license and help */
      ECORE_GETOPT_VALUE_BOOL(quit_option), /* -V/--version quits */

-- 


Reply via email to