ecore_con: disconnect from the server as soon as it request it.

Ecore_Event can still be in flight while the client get freed by the server.
We are protected agaist that and keep the client partially alive until the event
are processed, but we need to disconnect from the server as soon as possible
as we might outlive the server.
This commit is contained in:
Cedric BAIL 2018-05-23 18:03:56 -07:00
parent 256b2103c6
commit 384f30c8ec
1 changed files with 9 additions and 3 deletions

View File

@ -270,10 +270,13 @@ _ecore_con_client_socket_close(Ecore_Con_Client *cl)
static void
_ecore_con_client_free(Ecore_Con_Client *cl)
{
cl->delete_me = EINA_TRUE;
Ecore_Con_Server *svr = cl->svr;
if (cl->svr)
cl->svr->clients = eina_list_remove(cl->svr->clients, cl);
cl->delete_me = EINA_TRUE;
cl->svr = NULL;
if (svr)
svr->clients = eina_list_remove(svr->clients, cl);
_ecore_con_client_socket_close(cl);
@ -302,6 +305,9 @@ _ecore_con_client_free(Ecore_Con_Client *cl)
if (cl->event_count) return;
if (svr && (!svr->event_count) && (svr->delete_me))
_ecore_con_server_free(svr);
cl->data = NULL;
eina_stringshare_replace(&cl->ip, NULL);