diff --git a/modules/csync_owncloud.c b/modules/csync_owncloud.c index e63f576ad6..eb7274596a 100644 --- a/modules/csync_owncloud.c +++ b/modules/csync_owncloud.c @@ -1201,13 +1201,15 @@ static csync_vio_method_handle_t *owncloud_creat(const char *durl, mode_t mode) return handle; } -static int _user_want_abort() +static int _user_want_abort(void *userdata) { + (void)userdata; return csync_abort_requested(dav_session.csync_ctx); } -static void _log_callback(const char *func, const char *text) +static void _log_callback(const char *func, const char *text, void *userdata) { + (void)userdata; csync_log(CSYNC_LOG_PRIORITY_TRACE, func, "%s", text); } @@ -1355,7 +1357,7 @@ static int owncloud_sendfile(csync_vio_method_handle_t *src, csync_vio_method_ha if (write_ctx->req) ne_request_destroy( write_ctx->req ); - if( _user_want_abort() ) { + if( _user_want_abort(0) ) { errno = ERRNO_USER_ABORT; break; } diff --git a/src/httpbf/src/httpbf.c b/src/httpbf/src/httpbf.c index dee1a70447..5bd97bfdda 100644 --- a/src/httpbf/src/httpbf.c +++ b/src/httpbf/src/httpbf.c @@ -42,7 +42,7 @@ #define DEBUG_HBF(...) { if(transfer->log_cb) { \ char buf[1024]; \ snprintf(buf, 1024, __VA_ARGS__); \ - transfer->log_cb(__FUNCTION__, buf); \ + transfer->log_cb(__FUNCTION__, buf, transfer->user_data); \ } } #endif @@ -447,7 +447,7 @@ Hbf_State hbf_transfer( ne_session *session, hbf_transfer_t *transfer, const cha if( ! block ) state = HBF_PARAM_FAIL; if( transfer->abort_cb ) { - int do_abort = (transfer->abort_cb)(); + int do_abort = (transfer->abort_cb)(transfer->user_data); if( do_abort ) { state = HBF_USER_ABORTED; transfer->start_id = block_id % transfer->block_cnt; @@ -515,6 +515,10 @@ Hbf_State hbf_transfer( ne_session *session, hbf_transfer_t *transfer, const cha } } + if (state == HBF_TRANSFER_SUCCESS && transfer->chunk_finished_cb) { + transfer->chunk_finished_cb(transfer, block_id, transfer->user_data); + } + } else { state = HBF_MEMORY_FAIL; } diff --git a/src/httpbf/src/httpbf.h b/src/httpbf/src/httpbf.h index e00cc25315..c1e53249c1 100644 --- a/src/httpbf/src/httpbf.h +++ b/src/httpbf/src/httpbf.h @@ -72,13 +72,13 @@ struct hbf_block_s { int tries; }; -/* Callback for to check on abort */ -typedef int (*hbf_abort_callback) (); -typedef void (*hbf_log_callback) (const char *, const char *); - - typedef struct hbf_transfer_s hbf_transfer_t; +/* Callback for to check on abort */ +typedef int (*hbf_abort_callback) (void *); +typedef void (*hbf_log_callback) (const char *, const char *, void*); +typedef void (*hbf_chunk_finished_callback) (hbf_transfer_t*,int, void*); + struct hbf_transfer_s { hbf_block_t **block_arr; int block_cnt; @@ -95,8 +95,10 @@ struct hbf_transfer_s { int64_t block_size; int64_t threshold; + void *user_data; hbf_abort_callback abort_cb; hbf_log_callback log_cb; + hbf_chunk_finished_callback chunk_finished_cb; int modtime_accepted; const char *previous_etag; /* etag send as the If-Match http header */