mirror of https://github.com/BOINC/boinc.git
file upoad handler: if file is already there, don't upload again
Notes: 1) We still need to read all the data from socket (copy_socket_to_null()); otherwise the client will block on the send, and never get the success reply. The previous approach (read-only file) didn't do this. All we're saving is disk I/O on server. 2) The client reports a result only after it know that all its output files have successfully been uploaded. It won't re-upload anything if that's the case.
This commit is contained in:
parent
b544c31d37
commit
be50103751
|
@ -289,7 +289,7 @@ int handle_file_upload(FILE* in, R_RSA_PUBLIC_KEY& key) {
|
|||
double max_nbytes=-1;
|
||||
char xml_signature[1024];
|
||||
int retval;
|
||||
double offset=0, nbytes = -1;
|
||||
double offset=0, nbytes = -1, size;
|
||||
bool is_valid, btemp;
|
||||
|
||||
strcpy(name, "");
|
||||
|
@ -402,6 +402,17 @@ int handle_file_upload(FILE* in, R_RSA_PUBLIC_KEY& key) {
|
|||
name, boincerror(retval)
|
||||
);
|
||||
}
|
||||
|
||||
// if file already exists and is full size, don't upload again.
|
||||
//
|
||||
if (!file_size(path, size) && (size == nbytes)) {
|
||||
log_messages.printf(MSG_NORMAL,
|
||||
"file %s exists and is right size - skipping\n", name
|
||||
);
|
||||
copy_socket_to_null(in);
|
||||
return return_success(0);
|
||||
}
|
||||
|
||||
log_messages.printf(MSG_NORMAL,
|
||||
"Starting upload of %s from %s [offset=%.0f, nbytes=%.0f]\n",
|
||||
name,
|
||||
|
|
Loading…
Reference in New Issue