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
This commit is contained in:
Olivier Goffart 2013-11-25 19:08:50 +01:00
parent 13d755fc4d
commit 8ed02302ca
2 changed files with 5 additions and 5 deletions

View File

@ -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;

View File

@ -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