Fix flooder: broken reference.

This commit is contained in:
Théophile Bastian 2016-11-28 15:17:35 +01:00
parent 305e8ad254
commit 68347f8b0c

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