Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add block missing sync error #2694

Merged
merged 2 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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