}
ECORE_MAGIC_SET(url_con, ECORE_MAGIC_NONE);
- if (url_con->fd_handler)
+ if(url_con->fd != -1)
{
- ecore_main_fd_handler_del(url_con->fd_handler);
+ FD_CLR(url_con->fd, &_current_fd_set);
+ if (url_con->fd_handler)
+ ecore_main_fd_handler_del(url_con->fd_handler);
url_con->fd = -1;
+ url_con->fd_handler = NULL;
}
if (url_con->curl_easy)
{
url_con->received = 0;
- return _ecore_con_url_perform(url_con);
+ int res = _ecore_con_url_perform(url_con);
+
+ return res;
#else
return 0;
url_con = NULL;
{
if (url_con->fd_handler)
ecore_main_fd_handler_del(url_con->fd_handler);
+ url_con->fd_handler = NULL;
/* url_con still active -- set up an fd_handler */
FD_ZERO(&read_set);
/* Stupid curl, why can't I get the fd to the current added job? */
curl_multi_fdset(curlm, &read_set, &write_set, &exc_set, &fd_max);
+ int found = 0;
for (fd = 0; fd <= fd_max; fd++)
{
if (!FD_ISSET(fd, &_current_fd_set))
* Download @p url to the given @p dst
* @param url The complete url to download
* @param dst The local file to save the downloaded to
- * @param job_ret Here the protocol use is http or ftp, this parameter will be fill
- * with the job. The you con use ecore_file_download_abort() to cancel it.
+ * @param job_ret If the protocol use is http or ftp, this parameter will be fill
+ * with the job. Then you can use ecore_file_download_abort() to cancel it.
* @param completion_cb A callback called on download complete
* @param progress_cb A callback called during the download operation
* @return 1 if the download start or 0 on failure
url += 7;
/* skip hostname */
url = strchr(url, '/');
- return ecore_file_cp(url, dst);
+ return ecore_file_cp(url, dst);
}
# ifdef HAVE_CURL
else if ((!strncmp(url, "http://", 7)) ||
if (job->completion_cb)
job->completion_cb(ecore_con_url_data_get(job->url_con), job->dst, !ev->status);
- ecore_file_download_abort(job);
+ _job_list = eina_list_remove(_job_list, job);
+ fclose(job->file);
+ free(job->dst);
+ free(job);
return 0;
}
(long int) ev->down.total, (long int) ev->down.now,
(long int) ev->up.total, (long int) ev->up.now) != 0)
{
- ecore_file_download_abort(job);
+ _job_list = eina_list_remove(_job_list, job);
+ fclose(job->file);
+ free(job->dst);
+ free(job);
+
+ return 1;
}
return 0;
{
# ifdef HAVE_CURL
ecore_con_url_destroy(job->url_con);
-# endif
+# endif
_job_list = eina_list_remove(_job_list, job);
fclose(job->file);
free(job->dst);