uint32_t mrt;
uint32_t mrc;
uint32_t mrd;
+ uint32_t max_outstanding; //!< number of packets to run in parallel
+ uint32_t outstanding; //!< number of currently outstanding records;
fr_dlist_t list; //!< for retransmissions
int mode; //!< O_RDWR or O_RDONLY
- int outstanding; //!< number of outstanding records;
int count; //!< number of packets we read from this file.
size_t last_search; //!< where we last searched in the buffer
{ FR_CONF_OFFSET("maximum_retransmission_time", FR_TYPE_UINT32, proto_detail_work_t, mrt), .dflt = STRINGIFY(16) },
{ FR_CONF_OFFSET("maximum_retransmission_count", FR_TYPE_UINT32, proto_detail_work_t, mrc), .dflt = STRINGIFY(5) },
{ FR_CONF_OFFSET("maximum_retransmission_duration", FR_TYPE_UINT32, proto_detail_work_t, mrd), .dflt = STRINGIFY(30) },
+ { FR_CONF_OFFSET("maximum_outstanding", FR_TYPE_UINT32, proto_detail_work_t, max_outstanding), .dflt = STRINGIFY(1) },
CONF_PARSER_TERMINATOR
};
/*
* Pause reading until such time as we need more packets.
*/
- if (!inst->paused) {
+ if (!inst->paused && (inst->outstanding >= inst->max_outstanding)) {
(void) fr_event_filter_update(inst->el, inst->fd, FR_EVENT_FILTER_IO, pause_read);
inst->paused = true;
*/
inst->last_search = 0;
- MPRINT("Returning NUM %d - %.*s", inst->outstanding, (int) packet_len, buffer);
+ MPRINT("Returning NUM %u - %.*s", inst->outstanding, (int) packet_len, buffer);
return packet_len;
}
fr_dlist_insert_tail(&inst->list, &track->entry);
- if (inst->paused) {
+ if (inst->paused && (inst->outstanding < inst->max_outstanding)) {
(void) fr_event_filter_update(inst->el, inst->fd, FR_EVENT_FILTER_IO, resume_read);
inst->paused = false;
}
goto free_track;
}
- if (!inst->paused) {
+ if (!inst->paused && (inst->outstanding >= inst->max_outstanding)) {
(void) fr_event_filter_update(inst->el, inst->fd, FR_EVENT_FILTER_IO, pause_read);
inst->paused = true;
}
inst->outstanding--;
/*
- * There are no outstanding packets, let's go read some
- * more.
+ * If we need to read some more packet, let's do so.
*/
- if (!inst->outstanding && inst->paused) {
+ if (inst->paused && (inst->outstanding < inst->max_outstanding)) {
(void) fr_event_filter_update(inst->el, inst->fd, FR_EVENT_FILTER_IO, resume_read);
inst->paused = false;
}