split ecore_con_dns free functions into one that removes from list and one that does the freeing

This commit is contained in:
discomfitor 2013-12-20 22:16:29 -05:00
parent 0808259eff
commit 2a143393f9
1 changed files with 10 additions and 4 deletions

View File

@ -47,7 +47,6 @@ static dns_hosts *hosts = NULL;
static void
_ecore_con_dns_free(Ecore_Con_DNS *dns)
{
if (dns->svr->infos) dns->svr->infos = eina_list_remove(dns->svr->infos, dns);
if (dns->timer) ecore_timer_del(dns->timer);
if (dns->fdh) ecore_main_fd_handler_del(dns->fdh);
if (dns->ai) dns_ai_close(dns->ai);
@ -55,6 +54,13 @@ _ecore_con_dns_free(Ecore_Con_DNS *dns)
free(dns);
}
static void
_ecore_con_dns_del(Ecore_Con_DNS *dns)
{
if (dns->svr && dns->svr->infos) dns->svr->infos = eina_list_remove(dns->svr->infos, dns);
_ecore_con_dns_free(dns);
}
static Eina_Bool
_dns_addrinfo_get(Ecore_Con_DNS *dns, const char *addr, int port)
{
@ -102,13 +108,13 @@ _ecore_con_dns_check(Ecore_Con_DNS *dns)
dns->fdh = NULL;
dns->done_cb(dns->data, &result);
free(ent);
_ecore_con_dns_free(dns);
_ecore_con_dns_del(dns);
}
return 0;
error:
dns->done_cb(dns->data, NULL);
_ecore_con_dns_free(dns);
_ecore_con_dns_del(dns);
return -1;
}
@ -130,7 +136,7 @@ static Eina_Bool
_dns_timer_cb(Ecore_Con_DNS *dns)
{
dns->done_cb(dns->data, NULL);
_ecore_con_dns_free(dns);
_ecore_con_dns_del(dns);
return EINA_FALSE;
}