Skip to content

Commit

Permalink
Add block missing sync error (#2694)
Browse files Browse the repository at this point in the history
* Add block missing sync error

* Print response body when block is missing

---------

Co-authored-by: heran yang <heran.yang@seafile.com>
  • Loading branch information
feiniks and heran yang committed Jul 21, 2023
1 parent 5b44209 commit 98b5288
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
12 changes: 9 additions & 3 deletions daemon/http-tx-mgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#define HTTP_REPO_DELETED 444
#define HTTP_REPO_TOO_LARGE 447
#define HTTP_REPO_CORRUPTED 445
#define HTTP_BLOCK_MISSING 446
#define HTTP_INTERNAL_SERVER_ERROR 500

#define RESET_BYTES_INTERVAL_MSEC 1000
Expand Down Expand Up @@ -3817,11 +3818,16 @@ update_branch (HttpTxTask *task, Connection *conn)
seaf_warning ("Bad response code for PUT %s: %d.\n", url, status);
handle_http_errors (task, status);

if (status == HTTP_FORBIDDEN) {
if (status == HTTP_FORBIDDEN || status == HTTP_BLOCK_MISSING) {
rsp_content_str = g_new0 (gchar, rsp_size + 1);
memcpy (rsp_content_str, rsp_content, rsp_size);
seaf_warning ("%s\n", rsp_content_str);
notify_permission_error (task, rsp_content_str);
if (status == HTTP_FORBIDDEN) {
seaf_warning ("%s\n", rsp_content_str);
notify_permission_error (task, rsp_content_str);
} else if (status == HTTP_BLOCK_MISSING) {
seaf_warning ("Failed to upload files: %s\n", rsp_content_str);
task->error = SYNC_ERROR_ID_BLOCK_MISSING;
}
g_free (rsp_content_str);
}

Expand Down
5 changes: 5 additions & 0 deletions daemon/seafile-error.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ static SyncErrorInfo sync_error_info_tbl[] = {
SYNC_ERROR_LEVEL_FILE,
"Failed to checkout file on the client. Please check disk space or folder permissions"
},
{
SYNC_ERROR_ID_BLOCK_MISSING,
SYNC_ERROR_LEVEL_REPO,
"Failed to upload file blocks. Please check network or firewall"
},
};

const char *
Expand Down
3 changes: 2 additions & 1 deletion include/seafile-error.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#define SYNC_ERROR_ID_DEL_CONFIRMATION_PENDING 33
#define SYNC_ERROR_ID_TOO_MANY_FILES 34
#define SYNC_ERROR_ID_CHECKOUT_FILE 35
#define N_SYNC_ERROR_ID 36
#define SYNC_ERROR_ID_BLOCK_MISSING 36
#define N_SYNC_ERROR_ID 37

#endif

0 comments on commit 98b5288

Please sign in to comment.