mirror of https://github.com/BOINC/boinc.git
- client: when emerge from bandwidth quota network suspension,
add 0..1hr random delay to existing transfers, to avoid DDOS effect svn path=/trunk/boinc/; revision=21415
This commit is contained in:
parent
06cb521bbe
commit
7daae1d0c7
|
@ -3379,3 +3379,14 @@ David 7 May 2010
|
|||
WelcomePage.cpp
|
||||
lib/
|
||||
str_util.cpp,h
|
||||
|
||||
David 7 May 2010
|
||||
- client: when emerge from bandwidth quota network suspension,
|
||||
add 0..1hr random delay to existing transfers,
|
||||
to avoid DDOS effect
|
||||
|
||||
db/
|
||||
boinc_db.cpp
|
||||
client/
|
||||
client_state.cpp
|
||||
pers_file_xfer.cpp,h
|
||||
|
|
|
@ -679,6 +679,13 @@ bool CLIENT_STATE::poll_slow_events() {
|
|||
msg_printf(NULL, MSG_INFO, "Resuming file transfers");
|
||||
}
|
||||
}
|
||||
|
||||
// if we're emerging from a bandwidth quota suspension,
|
||||
// add a random delay to avoid DDOS effect
|
||||
//
|
||||
if (old_network_suspend_reason == SUSPEND_REASON_NETWORK_QUOTA_EXCEEDED) {
|
||||
pers_file_xfers->add_random_delay(3600);
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE:
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "error_numbers.h"
|
||||
#include "md5_file.h"
|
||||
#include "parse.h"
|
||||
#include "util.h"
|
||||
#include "str_util.h"
|
||||
#include "filesys.h"
|
||||
|
||||
|
@ -513,9 +514,20 @@ int PERS_FILE_XFER_SET::remove(PERS_FILE_XFER* pfx) {
|
|||
//
|
||||
void PERS_FILE_XFER_SET::suspend() {
|
||||
unsigned int i;
|
||||
|
||||
for (i=0; i<pers_file_xfers.size(); i++) {
|
||||
pers_file_xfers[i]->suspend();
|
||||
}
|
||||
}
|
||||
|
||||
// add a random delay 0..x to all transfers
|
||||
// (used when emerging from bandwidth quota suspension)
|
||||
//
|
||||
void PERS_FILE_XFER_SET::add_random_delay(double x) {
|
||||
unsigned int i;
|
||||
for (i=0; i<pers_file_xfers.size(); i++) {
|
||||
double y = gstate.now + x*drand();
|
||||
if (y > pers_file_xfers[i]->next_request_time) {
|
||||
pers_file_xfers[i]->next_request_time = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,6 +125,7 @@ public:
|
|||
int remove(PERS_FILE_XFER*);
|
||||
bool poll();
|
||||
void suspend();
|
||||
void add_random_delay(double);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2042,7 +2042,7 @@ int DB_SCHED_RESULT_ITEM_SET::update_workunits() {
|
|||
|
||||
void DB_FILE::db_print(char* buf){
|
||||
snprintf(buf, MAX_QUERY_LEN,
|
||||
"name='%s', md5sum=%s, size=%.15e",
|
||||
"name='%s', md5sum='%s', size=%.15e",
|
||||
name, md5sum, size
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue