From e2892804183b21302ad3ccd07122007bd30e9756 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz 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 SVN revision: 54204 --- legacy/ecore/src/lib/ecore_con/Ecore_Con.h | 1 + legacy/ecore/src/lib/ecore_con/ecore_con.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/legacy/ecore/src/lib/ecore_con/Ecore_Con.h b/legacy/ecore/src/lib/ecore_con/Ecore_Con.h index d5fc0df19f..b311785233 100644 --- a/legacy/ecore/src/lib/ecore_con/Ecore_Con.h +++ b/legacy/ecore/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/legacy/ecore/src/lib/ecore_con/ecore_con.c b/legacy/ecore/src/lib/ecore_con/ecore_con.c index 48c434e695..b8e934b4d0 100644 --- a/legacy/ecore/src/lib/ecore_con/ecore_con.c +++ b/legacy/ecore/src/lib/ecore_con/ecore_con.c @@ -922,6 +922,24 @@ ecore_con_client_server_get(Ecore_Con_Client *cl) return cl->host_server; } +/** + * 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