int n = parallel;
rc_request_t *next;
char const *filename = NULL;
+ time_t wake = 0;
done = true;
sleep_time = -1;
/*
* Walk over the packets, sending them.
*/
+ for (this = request_head; this != NULL; this = this->next) {
+ if (this->reply) continue;
+
+ if (!this->timestamp) continue;
+
+ if (!wake || (wake > (this->timestamp + ((int) timeout) * (retries - this->tries)))) {
+ wake = this->timestamp + ((int) timeout) * (retries - this->tries);
+ }
+ }
for (this = request_head; this != NULL; this = next) {
next = this->next;
break;
}
+ if (!wake || (wake > (this->timestamp + ((int) timeout) * (retries - this->tries)))) {
+ wake = this->timestamp + ((int) timeout) * (retries - this->tries);
+ }
+
/*
* Wait a little before sending
* the next packet, if told to.
* Still have outstanding requests.
*/
if (fr_packet_list_num_elements(pl) > 0) {
+ time_t now = time(NULL);
done = false;
+
+ /*
+ * The last time we wake up for a packet.
+ *
+ * If we're past that time, then give up.
+ */
+ if (wake < now) {
+ break;
+ }
+
} else {
sleep_time = 0;
}