summaryrefslogtreecommitdiff
path: root/src/lib/ecore_con
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 /src/lib/ecore_con
parent1e47db6a711a1f605bc765cb694d575af28ab85e (diff)
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 T7041 Depends on D6354 Reviewers: ManMower, devilhorns Reviewed By: ManMower Subscribers: cedric, #committers Tags: #efl Maniphest Tasks: T7041 Differential Revision: https://phab.enlightenment.org/D6355
Diffstat (limited to 'src/lib/ecore_con')
-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 0e6a896..d8dbd37 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;
73int _ecore_con_log_dom = -1; 73int _ecore_con_log_dom = -1;
74 74
75Eina_Bool _efl_net_proxy_helper_can_do (void); 75Eina_Bool _efl_net_proxy_helper_can_do (void);
76int _efl_net_proxy_helper_url_req_send(const char *url); 76int _efl_net_proxy_helper_url_req_send(const char *url, Ecore_Thread *eth);
77char **_efl_net_proxy_helper_url_wait (int id); 77char **_efl_net_proxy_helper_url_wait (int id);
78void _efl_net_proxy_helper_init (void); 78void _efl_net_proxy_helper_init (void);
79void _efl_net_proxy_helper_shutdown (void); 79void _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
2038} 2038}
2039 2039
2040static void 2040static void
2041_efl_net_ip_connect_async_run(void *data, Ecore_Thread *thread EINA_UNUSED) 2041_efl_net_ip_connect_async_run(void *data, Ecore_Thread *thread)
2042{ 2042{
2043 Efl_Net_Ip_Connect_Async_Data *d = data; 2043 Efl_Net_Ip_Connect_Async_Data *d = data;
2044 const char *host, *port, *proxy; 2044 const char *host, *port, *proxy;
@@ -2076,7 +2076,7 @@ _efl_net_ip_connect_async_run(void *data, Ecore_Thread *thread EINA_UNUSED)
2076 } 2076 }
2077 else 2077 else
2078 { 2078 {
2079 proxies = ecore_con_libproxy_proxies_get(url); 2079 proxies = ecore_con_libproxy_proxies_get(url, thread);
2080 eina_stringshare_del(url); 2080 eina_stringshare_del(url);
2081 } 2081 }
2082 } 2082 }
@@ -2578,9 +2578,9 @@ efl_net_udp_datagram_size_query(SOCKET fd)
2578} 2578}
2579 2579
2580char ** 2580char **
2581ecore_con_libproxy_proxies_get(const char *url) 2581ecore_con_libproxy_proxies_get(const char *url, Ecore_Thread *eth)
2582{ 2582{
2583 int id = _efl_net_proxy_helper_url_req_send(url); 2583 int id = _efl_net_proxy_helper_url_req_send(url, eth);
2584 if (id < 0) return NULL; 2584 if (id < 0) return NULL;
2585 return _efl_net_proxy_helper_url_wait(id); 2585 return _efl_net_proxy_helper_url_wait(id);
2586} 2586}
diff --git a/src/lib/ecore_con/ecore_con_private.h b/src/lib/ecore_con/ecore_con_private.h
index b1842fc..7f0c95d 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;
95/* init must be called from main thread */ 95/* init must be called from main thread */
96void ecore_con_libproxy_proxies_free(char **proxies); 96void ecore_con_libproxy_proxies_free(char **proxies);
97/* BLOCKING! should be called from a worker thread */ 97/* BLOCKING! should be called from a worker thread */
98char **ecore_con_libproxy_proxies_get(const char *url); 98char **ecore_con_libproxy_proxies_get(const char *url, Ecore_Thread *eth);
99 99
100 100
101Eina_Bool ecore_con_server_check(const Ecore_Con_Server *svr); 101Eina_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 f1f5aad..a4d953b 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)
321} 321}
322 322
323int 323int
324_efl_net_proxy_helper_url_req_send(const char *url) 324_efl_net_proxy_helper_url_req_send(const char *url, Ecore_Thread *eth)
325{ 325{
326 char *buf; 326 char *buf;
327 int id = -1; 327 int id = -1;
@@ -339,6 +339,7 @@ _efl_net_proxy_helper_url_req_send(const char *url)
339 locks--; 339 locks--;
340 } 340 }
341 eina_spinlock_release(&_efl_net_proxy_helper_queue_lock); 341 eina_spinlock_release(&_efl_net_proxy_helper_queue_lock);
342 if (ecore_thread_check(eth)) return -1;
342 // create request to quque up to look up responses for 343 // create request to quque up to look up responses for
343 req = calloc(1, sizeof(Efl_Net_Proxy_Helper_Req)); 344 req = calloc(1, sizeof(Efl_Net_Proxy_Helper_Req));
344 if (!req) return -1; 345 if (!req) return -1;
@@ -352,9 +353,10 @@ _efl_net_proxy_helper_url_req_send(const char *url)
352 buf = alloca(strlen(url) + 256); 353 buf = alloca(strlen(url) + 256);
353 sprintf(buf, "P %i %s\n", req->id, url); 354 sprintf(buf, "P %i %s\n", req->id, url);
354 req->str = strdup(buf); 355 req->str = strdup(buf);
355 if (!req->str) 356 if ((!req->str) || ecore_thread_check(eth))
356 { 357 {
357 eina_thread_queue_free(req->thq); 358 eina_thread_queue_free(req->thq);
359 free(req->str);
358 free(req); 360 free(req);
359 return -1; 361 return -1;
360 } 362 }
diff --git a/src/lib/ecore_con/efl_net_dialer_http.c b/src/lib/ecore_con/efl_net_dialer_http.c
index df1fedf..f1f18a0 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 {
1226} Efl_Net_Dialer_Http_Libproxy_Context; 1226} Efl_Net_Dialer_Http_Libproxy_Context;
1227 1227
1228static void 1228static void
1229_efl_net_dialer_http_libproxy_run(void *data, Ecore_Thread *thread EINA_UNUSED) 1229_efl_net_dialer_http_libproxy_run(void *data, Ecore_Thread *thread)
1230{ 1230{
1231 Efl_Net_Dialer_Http_Libproxy_Context *ctx = data; 1231 Efl_Net_Dialer_Http_Libproxy_Context *ctx = data;
1232 char **proxies = ecore_con_libproxy_proxies_get(ctx->url); 1232 char **proxies = ecore_con_libproxy_proxies_get(ctx->url, thread);
1233 char **itr; 1233 char **itr;
1234 1234
1235 if (!proxies) return; 1235 if (!proxies) return;