summaryrefslogtreecommitdiff
path: root/src/lib/ecore_con
diff options
context:
space:
mode:
authorSrivardhan Hebbar <sri.hebbar@samsung.com>2015-04-10 11:27:17 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-04-10 12:05:05 +0200
commit709037a95d7cc4a040f90a39a8551f256dfca276 (patch)
tree06ec48e37964246af3a0e2391c59080e4e98f431 /src/lib/ecore_con
parent3b46609140c4228490e4d65e754f77e73c86ef2a (diff)
ecore_con: fix stack overflow in ecore_con_url_timer issue.
Summary: last_ms is not needed at all. If curl_multi_timeout returns non zero, then its error, if it returns zero, then its fine. If ms is zero, then call curl_multi_perform immediately. Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com> Reviewers: cedric Subscribers: cedric Maniphest Tasks: T2200 Differential Revision: https://phab.enlightenment.org/D2294 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'src/lib/ecore_con')
-rw-r--r--src/lib/ecore_con/ecore_con_url.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/src/lib/ecore_con/ecore_con_url.c b/src/lib/ecore_con/ecore_con_url.c
index 05b9d05a71..68b2a823dd 100644
--- a/src/lib/ecore_con/ecore_con_url.c
+++ b/src/lib/ecore_con/ecore_con_url.c
@@ -285,7 +285,6 @@ static Eina_List *_fd_hd_list = NULL;
285static int _init_count = 0; 285static int _init_count = 0;
286static Ecore_Timer *_curl_timer = NULL; 286static Ecore_Timer *_curl_timer = NULL;
287static Eina_Bool pipelining = EINA_FALSE; 287static Eina_Bool pipelining = EINA_FALSE;
288static long last_ms = -1;
289 288
290static Ecore_Con_Curl *_c = NULL; 289static Ecore_Con_Curl *_c = NULL;
291static Eina_Bool _c_fail = EINA_FALSE; 290static Eina_Bool _c_fail = EINA_FALSE;
@@ -354,7 +353,6 @@ _c_init(void)
354 } 353 }
355 _c->curl_multi_timeout(_c->_curlm, &ms); 354 _c->curl_multi_timeout(_c->_curlm, &ms);
356 if ((ms >= CURL_MIN_TIMEOUT) || (ms < 0)) ms = CURL_MIN_TIMEOUT; 355 if ((ms >= CURL_MIN_TIMEOUT) || (ms < 0)) ms = CURL_MIN_TIMEOUT;
357 last_ms = ms;
358 _curl_timer = ecore_timer_add((double)ms / 1000.0, 356 _curl_timer = ecore_timer_add((double)ms / 1000.0,
359 _ecore_con_url_timer, NULL); 357 _ecore_con_url_timer, NULL);
360 ecore_timer_freeze(_curl_timer); 358 ecore_timer_freeze(_curl_timer);
@@ -1536,7 +1534,6 @@ _ecore_con_url_curl_clear(void)
1536 ecore_main_fd_handler_del(fdh); 1534 ecore_main_fd_handler_del(fdh);
1537 EINA_LIST_FREE(_url_con_list, url_con) 1535 EINA_LIST_FREE(_url_con_list, url_con)
1538 _ecore_con_url_multi_remove(url_con); 1536 _ecore_con_url_multi_remove(url_con);
1539 last_ms = -1;
1540} 1537}
1541 1538
1542static Eina_Bool 1539static Eina_Bool
@@ -1545,28 +1542,26 @@ _ecore_con_url_do_multi_timeout(long *retms)
1545 long ms = 0; 1542 long ms = 0;
1546 int ret; 1543 int ret;
1547 1544
1548 while (!ms) 1545 ret = _c->curl_multi_timeout(_c->_curlm, &ms);
1546 *retms = ms;
1547 if (!ret)
1549 { 1548 {
1550 ret = _c->curl_multi_timeout(_c->_curlm, &ms); 1549 if (!ms)
1551 *retms = ms;
1552 if ((last_ms > 0) && (ms < 0))
1553 ERR("curl_multi_perform() timeout");
1554 else if (ms <= 0)
1555 { 1550 {
1556 last_ms = ms;
1557 _ecore_con_url_timer(NULL); 1551 _ecore_con_url_timer(NULL);
1558 DBG("multiperform is still running: timeout: %ld", ms); 1552 DBG("multiperform is still running: timeout: %ld", ms);
1559 return EINA_TRUE;
1560 } 1553 }
1561 else if ((ret <= 0) && (ms > 0)) break; 1554 return EINA_TRUE;
1562 else 1555 }
1563 ERR("curl_multi_perform() failed: %s", _c->curl_multi_strerror(ret)); 1556 else
1564 last_ms = ms; 1557 {
1565 _ecore_con_url_curl_clear(); 1558 ERR("curl_multi_perform() failed: %s",
1566 ecore_timer_freeze(_curl_timer); 1559 _c->curl_multi_strerror(ret));
1567 return EINA_FALSE; 1560 _ecore_con_url_curl_clear();
1561 ecore_timer_freeze(_curl_timer);
1562
1563 return EINA_FALSE;
1568 } 1564 }
1569 return EINA_TRUE;
1570} 1565}
1571 1566
1572static Eina_Bool 1567static Eina_Bool
@@ -1579,7 +1574,6 @@ _ecore_con_url_fd_handler(void *data EINA_UNUSED, Ecore_Fd_Handler *fd_handler E
1579 EINA_LIST_FREE(_fd_hd_list, fdh) 1574 EINA_LIST_FREE(_fd_hd_list, fdh)
1580 ecore_main_fd_handler_del(fdh); 1575 ecore_main_fd_handler_del(fdh);
1581 if (!_ecore_con_url_do_multi_timeout(&ms)) return EINA_FALSE; 1576 if (!_ecore_con_url_do_multi_timeout(&ms)) return EINA_FALSE;
1582 last_ms = ms;
1583 if ((ms >= CURL_MIN_TIMEOUT) || (ms <= 0)) ms = CURL_MIN_TIMEOUT; 1577 if ((ms >= CURL_MIN_TIMEOUT) || (ms <= 0)) ms = CURL_MIN_TIMEOUT;
1584 ecore_timer_interval_set(_curl_timer, (double)ms / 1000.0); 1578 ecore_timer_interval_set(_curl_timer, (double)ms / 1000.0);
1585 ecore_timer_reset(_curl_timer); 1579 ecore_timer_reset(_curl_timer);
@@ -1659,7 +1653,6 @@ _ecore_con_url_timer(void *data EINA_UNUSED)
1659 1653
1660 _ecore_con_url_fdset(); 1654 _ecore_con_url_fdset();
1661 if (!_ecore_con_url_do_multi_timeout(&ms)) return EINA_FALSE; 1655 if (!_ecore_con_url_do_multi_timeout(&ms)) return EINA_FALSE;
1662 last_ms = ms;
1663 DBG("multiperform is still running: %d, timeout: %ld", 1656 DBG("multiperform is still running: %d, timeout: %ld",
1664 still_running, ms); 1657 still_running, ms);
1665 if ((ms >= CURL_MIN_TIMEOUT) || (ms < 0)) ms = CURL_MIN_TIMEOUT; 1658 if ((ms >= CURL_MIN_TIMEOUT) || (ms < 0)) ms = CURL_MIN_TIMEOUT;