From 344ea661c9a777560aa15a4fa166d02ba1ce7498 Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Wed, 31 Jul 2013 16:26:28 +0200 Subject: [PATCH] Add more logging to chunking routines. --- modules/csync_owncloud.c | 3 +++ src/httpbf/src/httpbf.c | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/csync_owncloud.c b/modules/csync_owncloud.c index 31643e4cb..2c0a59fd2 100644 --- a/modules/csync_owncloud.c +++ b/modules/csync_owncloud.c @@ -1250,6 +1250,9 @@ static int owncloud_sendfile(csync_vio_method_handle_t *src, csync_vio_method_ha state = hbf_splitlist(trans, fd); file_size = trans->stat_size; + DEBUG_WEBDAV("about to send %d block", trans->block_cnt); + + /* Reuse chunk info that was stored in database if existing. */ if (dav_session.chunk_info && dav_session.chunk_info->transfer_id) { DEBUG_WEBDAV("Existing chunk info %d %d ", dav_session.chunk_info->start_id, dav_session.chunk_info->transfer_id); diff --git a/src/httpbf/src/httpbf.c b/src/httpbf/src/httpbf.c index 12aae614f..ccec3cf0e 100644 --- a/src/httpbf/src/httpbf.c +++ b/src/httpbf/src/httpbf.c @@ -122,6 +122,9 @@ Hbf_State hbf_splitlist(hbf_transfer_t *transfer, int fd ) { transfer->calc_size = 0; #endif + DEBUG_HBF("hbf_splitlist: block_size: %ld threshold: %ld st_size: %ld\n", transfer->block_size, transfer->threshold, sb.st_size ); + + /* calc the number of blocks to split in */ blk_size = transfer->block_size; if (sb.st_size < transfer->threshold) { @@ -144,6 +147,9 @@ Hbf_State hbf_splitlist(hbf_transfer_t *transfer, int fd ) { blk_size = 0; } + DEBUG_HBF("hbf_splitlist: num_blocks: %ld rmainder: %ld blk_size: %ld\n", num_blocks, remainder, blk_size ); + + if( num_blocks ) { int cnt; int64_t overall = 0; @@ -172,7 +178,10 @@ Hbf_State hbf_splitlist(hbf_transfer_t *transfer, int fd ) { overall += block->size; /* store the block data into the result array in the transfer */ *((transfer->block_arr)+cnt) = block; + + DEBUG_HBF("hbf_splitlist: created block %d (start: %ld size: %ld)\n", cnt, block->start, block->size ); } + #ifndef NDEBUG transfer->calc_size = overall; #endif @@ -269,7 +278,7 @@ static int dav_request( ne_request *req, int fd, hbf_block_t *blk ) { if( ! (blk && req) ) return HBF_PARAM_FAIL; ne_set_request_body_fd(req, fd, blk->start, blk->size); - /* DEBUG_HBF("HBF: Block: %d , Start: %ld and Size: %ld\n", blk->seq_number, blk->start, blk->size ); */ + DEBUG_HBF("HBF: Block: %d , Start: %ld and Size: %ld\n", blk->seq_number, blk->start, blk->size ); res = ne_request_dispatch(req); req_status = ne_get_status( req );