+ // 2a. Look for additional announcements that are worth accelerating
+ // They must be (a) at least half-way to their next announcement and
+ // (b) at an interval equal or less than any of the ones we've already put in
+ for (rr = m->ResourceRecords; rr; rr=rr->next)
+ {
+ if (rr->InterfaceAddr.NotAnInteger == InterfaceAddr.NotAnInteger &&
+ rr->AnnounceCount && ResourceRecordIsValidAnswer(rr) &&
+ timenow - (rr->LastSendTime + rr->NextSendInterval/4) >= 0 &&
+ rr->NextSendInterval <= minExistingAnnounceInterval)
+ {
+ newptr = putResourceRecord(response, responseptr, &response->h.numAnswers, rr, m, timenow);
+ if (newptr)
+ {
+ numAnnounce++;
+ responseptr = newptr;
+ }
+ // If we were able to put the record, then update the state variables
+ // If we were unable to put the record because it is too large to fit, even though
+ // there are no other answers in the packet, then pretend we succeeded anyway,
+ // or we'll end up in an infinite loop trying to send a record that will never fit
+ if (response->h.numAnswers == 0) debugf("BuildResponse announcements failed");
+ if (newptr || response->h.numAnswers == 0)
+ {
+ rr->SendPriority = 0;
+ rr->Requester = zeroIPAddr;
+ rr->AnnounceCount--;
+ rr->NextSendTime = timenow + rr->NextSendInterval;
+ rr->NextSendInterval *= 2;
+ }
+ }
+ }
+