aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/ecore_file
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2016-11-23 16:23:58 -0200
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>2016-11-23 16:23:58 -0200
commit4b771d3e1b3fd17ebab6c410b38ef451248a422a (patch)
tree355ff12e91ebfd56bafa2766e391b37fc25bf10d /src/lib/ecore_file
parentecore_ipc: implement ecore_con_server_connect() using Efl.Net.Dialer. (diff)
downloadefl-4b771d3e1b3fd17ebab6c410b38ef451248a422a.tar.gz
ecore_file_download: callback completion_cb with status=1.
When download is aborted we must call completion_cb using status == 1, this was checked in the test suite.
Diffstat (limited to 'src/lib/ecore_file')
-rw-r--r--src/lib/ecore_file/ecore_file_download.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/lib/ecore_file/ecore_file_download.c b/src/lib/ecore_file/ecore_file_download.c
index 406d6cabc9..bcb83935dd 100644
--- a/src/lib/ecore_file/ecore_file_download.c
+++ b/src/lib/ecore_file/ecore_file_download.c
@@ -77,6 +77,7 @@ _ecore_file_download_copier_done(void *data, const Efl_Event *event EINA_UNUSED)
{
Ecore_File_Download_Completion_Cb cb = job->completion_cb;
job->completion_cb = NULL;
+ ECORE_MAGIC_SET(job, ECORE_MAGIC_NONE);
cb((void *)job->data, file, status);
}
@@ -298,6 +299,8 @@ ecore_file_download_protocol_available(const char *protocol)
EAPI void
ecore_file_download_abort(Ecore_File_Download_Job *job)
{
+ const char *file;
+
if (!job)
return;
if (!ECORE_MAGIC_CHECK(job, ECORE_MAGIC_FILE_DOWNLOAD_JOB))
@@ -306,8 +309,19 @@ ecore_file_download_abort(Ecore_File_Download_Job *job)
return;
}
- /* don't call it from _ecore_file_download_copier_done() */
- if (job->completion_cb) job->completion_cb = NULL;
+ efl_file_get(job->output, &file, NULL);
+ DBG("Aborting download %s -> %s",
+ efl_net_dialer_address_dial_get(job->input),
+ file);
+
+ /* abort should have status = 1 */
+ if (job->completion_cb)
+ {
+ Ecore_File_Download_Completion_Cb cb = job->completion_cb;
+ job->completion_cb = NULL;
+ ECORE_MAGIC_SET(job, ECORE_MAGIC_NONE);
+ cb((void *)job->data, file, 1);
+ }
/* efl_io_closer_close()
* -> _ecore_file_download_copier_done()