Fix flooder: broken reference.

This commit is contained in:
Théophile Bastian 2016-11-28 15:17:35 +01:00
parent 305e8ad254
commit 68347f8b0c
1 changed files with 5 additions and 1 deletions

View File

@ -13,6 +13,8 @@ Flooder::Flooder(const Bytes& data, u64 datId, u32 seqno, Protocol* proto,
for(auto it=peers.begin(); it != peers.end(); ++it) {
triesCount[it->id] = 0;
toFlood.push(FloodEvt(time(NULL), it->id));
fprintf(stderr, "[DBG] Flood %lX init towards %lX\n",
datId, it->id);
}
update();
}
@ -30,12 +32,14 @@ Flooder::~Flooder() {
void Flooder::update() {
while(!toFlood.empty()) {
const FloodEvt& evt = toFlood.top();
FloodEvt evt = toFlood.top();
if(evt.time > time(NULL)) {
break;
}
toFlood.pop();
fprintf(stderr, "[DBG] Flooding to %lX\n", evt.id);
if(triesCount[evt.id] > csts::FLOOD_RETRIES) {
fprintf(stderr, "[WARNING] Could not flood to %lX: no IHave.\n",
evt.id);