aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2018-06-25 15:13:22 -0400
committerMike Blumenkrantz <zmike@samsung.com>2018-06-25 15:14:31 -0400
commit0e40fad4466a60238438c131b3331319c38c694b (patch)
tree66c967a94609817b04ce44ad0c82bdc9024c6bed
parentecore/thread: track "no_queue" threads (diff)
downloadefl-0e40fad4466a60238438c131b3331319c38c694b.tar.gz
ecore_con: make dns resolver thread stop blocking when canceled
Summary: if the user or system attempts to cancel this thread then it should stop blocking and exit in order to avoid potentially exiting after efl has expected ecore-con to stop being active @fix fix https://phab.enlightenment.org/T7041 Depends on https://phab.enlightenment.org/D6354 Reviewers: ManMower, devilhorns Reviewed By: ManMower Subscribers: cedric, #committers Tags: #efl Maniphest Tasks: https://phab.enlightenment.org/T7041 Differential Revision: https://phab.enlightenment.org/D6355
-rw-r--r--src/lib/ecore_con/ecore_con.c10
-rw-r--r--src/lib/ecore_con/ecore_con_private.h2
-rw-r--r--src/lib/ecore_con/ecore_con_proxy_helper.c6
-rw-r--r--src/lib/ecore_con/efl_net_dialer_http.c4
4 files changed, 12 insertions, 10 deletions
diff --git a/src/lib/ecore_con/ecore_con.c b/src/lib/ecore_con/ecore_con.c
index 0e6a896eb6..d8dbd37a58 100644
--- a/src/lib/ecore_con/ecore_con.c
+++ b/src/lib/ecore_con/ecore_con.c
@@ -73,7 +73,7 @@ static int _ecore_con_init_count = 0;
int _ecore_con_log_dom = -1;
Eina_Bool _efl_net_proxy_helper_can_do (void);
-int _efl_net_proxy_helper_url_req_send(const char *url);
+int _efl_net_proxy_helper_url_req_send(const char *url, Ecore_Thread *eth);
char **_efl_net_proxy_helper_url_wait (int id);
void _efl_net_proxy_helper_init (void);
void _efl_net_proxy_helper_shutdown (void);
@@ -2038,7 +2038,7 @@ _efl_net_ip_connect_async_run_socks5h(Efl_Net_Ip_Connect_Async_Data *d, const ch
}
static void
-_efl_net_ip_connect_async_run(void *data, Ecore_Thread *thread EINA_UNUSED)
+_efl_net_ip_connect_async_run(void *data, Ecore_Thread *thread)
{
Efl_Net_Ip_Connect_Async_Data *d = data;
const char *host, *port, *proxy;
@@ -2076,7 +2076,7 @@ _efl_net_ip_connect_async_run(void *data, Ecore_Thread *thread EINA_UNUSED)
}
else
{
- proxies = ecore_con_libproxy_proxies_get(url);
+ proxies = ecore_con_libproxy_proxies_get(url, thread);
eina_stringshare_del(url);
}
}
@@ -2578,9 +2578,9 @@ efl_net_udp_datagram_size_query(SOCKET fd)
}
char **
-ecore_con_libproxy_proxies_get(const char *url)
+ecore_con_libproxy_proxies_get(const char *url, Ecore_Thread *eth)
{
- int id = _efl_net_proxy_helper_url_req_send(url);
+ int id = _efl_net_proxy_helper_url_req_send(url, eth);
if (id < 0) return NULL;
return _efl_net_proxy_helper_url_wait(id);
}
diff --git a/src/lib/ecore_con/ecore_con_private.h b/src/lib/ecore_con/ecore_con_private.h
index b1842fc2e9..7f0c95d61d 100644
--- a/src/lib/ecore_con/ecore_con_private.h
+++ b/src/lib/ecore_con/ecore_con_private.h
@@ -95,7 +95,7 @@ extern int sd_fd_max;
/* init must be called from main thread */
void ecore_con_libproxy_proxies_free(char **proxies);
/* BLOCKING! should be called from a worker thread */
-char **ecore_con_libproxy_proxies_get(const char *url);
+char **ecore_con_libproxy_proxies_get(const char *url, Ecore_Thread *eth);
Eina_Bool ecore_con_server_check(const Ecore_Con_Server *svr);
diff --git a/src/lib/ecore_con/ecore_con_proxy_helper.c b/src/lib/ecore_con/ecore_con_proxy_helper.c
index f1f5aadaf1..a4d953ba7f 100644
--- a/src/lib/ecore_con/ecore_con_proxy_helper.c
+++ b/src/lib/ecore_con/ecore_con_proxy_helper.c
@@ -321,7 +321,7 @@ _efl_net_proxy_helper_cb_send_do(void *data)
}
int
-_efl_net_proxy_helper_url_req_send(const char *url)
+_efl_net_proxy_helper_url_req_send(const char *url, Ecore_Thread *eth)
{
char *buf;
int id = -1;
@@ -339,6 +339,7 @@ _efl_net_proxy_helper_url_req_send(const char *url)
locks--;
}
eina_spinlock_release(&_efl_net_proxy_helper_queue_lock);
+ if (ecore_thread_check(eth)) return -1;
// create request to quque up to look up responses for
req = calloc(1, sizeof(Efl_Net_Proxy_Helper_Req));
if (!req) return -1;
@@ -352,9 +353,10 @@ _efl_net_proxy_helper_url_req_send(const char *url)
buf = alloca(strlen(url) + 256);
sprintf(buf, "P %i %s\n", req->id, url);
req->str = strdup(buf);
- if (!req->str)
+ if ((!req->str) || ecore_thread_check(eth))
{
eina_thread_queue_free(req->thq);
+ free(req->str);
free(req);
return -1;
}
diff --git a/src/lib/ecore_con/efl_net_dialer_http.c b/src/lib/ecore_con/efl_net_dialer_http.c
index df1fedf61e..f1f18a0c7a 100644
--- a/src/lib/ecore_con/efl_net_dialer_http.c
+++ b/src/lib/ecore_con/efl_net_dialer_http.c
@@ -1226,10 +1226,10 @@ typedef struct _Efl_Net_Dialer_Http_Libproxy_Context {
} Efl_Net_Dialer_Http_Libproxy_Context;
static void
-_efl_net_dialer_http_libproxy_run(void *data, Ecore_Thread *thread EINA_UNUSED)
+_efl_net_dialer_http_libproxy_run(void *data, Ecore_Thread *thread)
{
Efl_Net_Dialer_Http_Libproxy_Context *ctx = data;
- char **proxies = ecore_con_libproxy_proxies_get(ctx->url);
+ char **proxies = ecore_con_libproxy_proxies_get(ctx->url, thread);
char **itr;
if (!proxies) return;