From 8ed02302ca1805ab631e06effd9ccadff89eb415 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 25 Nov 2013 19:08:50 +0100 Subject: [PATCH] Don't check if the file has changed after the upload is complete. After the upload is complete, the file has been changed in the server and the etag need to be updated in the db if we don't want to have desatrous conflicts later. Let mirall know the real status, and expose the function to check weather the file has changed so mirall can do thing properly --- src/httpbf/src/httpbf.c | 8 +++----- src/httpbf/src/httpbf.h | 2 ++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/httpbf/src/httpbf.c b/src/httpbf/src/httpbf.c index bbce7f7d11..9201afd900 100644 --- a/src/httpbf/src/httpbf.c +++ b/src/httpbf/src/httpbf.c @@ -361,7 +361,7 @@ static int _hbf_dav_request(hbf_transfer_t *transfer, ne_request *req, int fd, h return state; } -static Hbf_State validate_source_file( hbf_transfer_t *transfer ) { +Hbf_State hbf_validate_source_file( hbf_transfer_t *transfer ) { Hbf_State state = HBF_SUCCESS; hbf_stat_t sb; @@ -476,7 +476,7 @@ Hbf_State hbf_transfer( ne_session *session, hbf_transfer_t *transfer, const cha if( state == HBF_TRANSFER_SUCCESS ) { if( transfer->block_cnt > 1 && cnt > 0 ) { /* The block count is > 1, check size and mtime before transmitting. */ - state = validate_source_file(transfer); + state = hbf_validate_source_file(transfer); if( state == HBF_SOURCE_FILE_CHANGE ) { /* The source file has changed meanwhile */ } @@ -541,9 +541,7 @@ Hbf_State hbf_transfer( ne_session *session, hbf_transfer_t *transfer, const cha } /* do the source file validation finally (again). */ - if( state == HBF_SUCCESS ) { - state = validate_source_file(transfer); - } else if( state == HBF_TRANSFER_SUCCESS ) { + if( state == HBF_TRANSFER_SUCCESS ) { /* This means that no etag was returned on one of the chunks to indicate * that the upload was finished. */ state = HBF_TRANSFER_NOT_ACKED; diff --git a/src/httpbf/src/httpbf.h b/src/httpbf/src/httpbf.h index b6042190e4..5972b3e7ef 100644 --- a/src/httpbf/src/httpbf.h +++ b/src/httpbf/src/httpbf.h @@ -131,6 +131,8 @@ void hbf_set_log_callback( hbf_transfer_t *transfer, hbf_log_callback cb); */ int hbf_fail_http_code( hbf_transfer_t *transfer ); +Hbf_State hbf_validate_source_file( hbf_transfer_t *transfer ); + #ifdef __cplusplus } #endif