diff options
author | Gustavo Sverzut Barbieri <barbieri@profusion.mobi> | 2016-11-23 16:23:58 -0200 |
---|---|---|
committer | Gustavo Sverzut Barbieri <barbieri@profusion.mobi> | 2016-11-23 16:23:58 -0200 |
commit | 4b771d3e1b3fd17ebab6c410b38ef451248a422a (patch) | |
tree | 355ff12e91ebfd56bafa2766e391b37fc25bf10d | |
parent | e34b07e6e28d8bf40d581e97ce617028b5ecce04 (diff) |
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.
-rw-r--r-- | src/lib/ecore_file/ecore_file_download.c | 18 |
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) | |||
77 | { | 77 | { |
78 | Ecore_File_Download_Completion_Cb cb = job->completion_cb; | 78 | Ecore_File_Download_Completion_Cb cb = job->completion_cb; |
79 | job->completion_cb = NULL; | 79 | job->completion_cb = NULL; |
80 | ECORE_MAGIC_SET(job, ECORE_MAGIC_NONE); | ||
80 | cb((void *)job->data, file, status); | 81 | cb((void *)job->data, file, status); |
81 | } | 82 | } |
82 | 83 | ||
@@ -298,6 +299,8 @@ ecore_file_download_protocol_available(const char *protocol) | |||
298 | EAPI void | 299 | EAPI void |
299 | ecore_file_download_abort(Ecore_File_Download_Job *job) | 300 | ecore_file_download_abort(Ecore_File_Download_Job *job) |
300 | { | 301 | { |
302 | const char *file; | ||
303 | |||
301 | if (!job) | 304 | if (!job) |
302 | return; | 305 | return; |
303 | if (!ECORE_MAGIC_CHECK(job, ECORE_MAGIC_FILE_DOWNLOAD_JOB)) | 306 | if (!ECORE_MAGIC_CHECK(job, ECORE_MAGIC_FILE_DOWNLOAD_JOB)) |
@@ -306,8 +309,19 @@ ecore_file_download_abort(Ecore_File_Download_Job *job) | |||
306 | return; | 309 | return; |
307 | } | 310 | } |
308 | 311 | ||
309 | /* don't call it from _ecore_file_download_copier_done() */ | 312 | efl_file_get(job->output, &file, NULL); |
310 | if (job->completion_cb) job->completion_cb = NULL; | 313 | DBG("Aborting download %s -> %s", |
314 | efl_net_dialer_address_dial_get(job->input), | ||
315 | file); | ||
316 | |||
317 | /* abort should have status = 1 */ | ||
318 | if (job->completion_cb) | ||
319 | { | ||
320 | Ecore_File_Download_Completion_Cb cb = job->completion_cb; | ||
321 | job->completion_cb = NULL; | ||
322 | ECORE_MAGIC_SET(job, ECORE_MAGIC_NONE); | ||
323 | cb((void *)job->data, file, 1); | ||
324 | } | ||
311 | 325 | ||
312 | /* efl_io_closer_close() | 326 | /* efl_io_closer_close() |
313 | * -> _ecore_file_download_copier_done() | 327 | * -> _ecore_file_download_copier_done() |