From 36bab5404f876e8b77712ad97febed358d0a7d12 Mon Sep 17 00:00:00 2001 From: discomfitor Date: Sat, 6 Nov 2010 00:17:04 +0000 Subject: [PATCH] add ecore_con_client_connected_get to avoid people scratching their heads and wondering how the hell they're supposed to know if a client has disconnected git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@54204 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/ecore_con/Ecore_Con.h | 1 + src/lib/ecore_con/ecore_con.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/lib/ecore_con/Ecore_Con.h b/src/lib/ecore_con/Ecore_Con.h index d5fc0df..b311785 100644 --- a/src/lib/ecore_con/Ecore_Con.h +++ b/src/lib/ecore_con/Ecore_Con.h @@ -448,6 +448,7 @@ EAPI void ecore_con_client_flush(Ecore_Con_Client *cl); EAPI double ecore_con_client_uptime_get(Ecore_Con_Client *cl); EAPI double ecore_con_client_timeout_get(Ecore_Con_Client *cl); EAPI void ecore_con_client_timeout_set(Ecore_Con_Client *cl, double timeout); +EAPI Eina_Bool ecore_con_client_connected_get(Ecore_Con_Client *cl); /** * @} diff --git a/src/lib/ecore_con/ecore_con.c b/src/lib/ecore_con/ecore_con.c index 48c434e..b8e934b 100644 --- a/src/lib/ecore_con/ecore_con.c +++ b/src/lib/ecore_con/ecore_con.c @@ -923,6 +923,24 @@ ecore_con_client_server_get(Ecore_Con_Client *cl) } /** + * Returns whether the client is still connected + * @param cl The given client. + * @return #EINA_TRUE if connected, else EINA_FALSE + */ +EAPI Eina_Bool +ecore_con_client_connected_get(Ecore_Con_Client *cl) +{ + if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT)) + { + ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, + "ecore_con_client_connected_get"); + return EINA_FALSE; + } + + return !cl->dead; +} + +/** * Set the time after which the client will be disconnected when inactive * @param cl The client object * @param timeout The timeout, in seconds, to disconnect after -- 2.7.4