return 0;
}
+ if (track->discard) {
+ DEBUG("Ignoring transmit from client %s - we previously received a newer / conflicting packet", client->radclient->shortname);
+ return 0;
+ }
+
if (!track->reply) {
fr_assert(!track->finished);
DEBUG("Ignoring retransmit from client %s - we are still processing the request", client->radclient->shortname);
fr_client_t *radclient;
fr_listen_t *child;
fr_event_list_t *el;
+ char const *name;
get_inst(li, &inst, &thread, &connection, &child);
client = track->client;
if (connection) {
el = connection->el;
+ name = connection->name;
} else {
el = thread->el;
+ name = li->name;
}
+ DEBUG3("Processing reply for %s", name);
+
/*
* A fully defined client means that we just send the reply.
*/
track->finished = true;
/*
- * The request later received a conflicting
- * packet, so we discard this one.
+ * The request received a conflicting packet, so we
+ * discard this one.
*/
if (fr_time_neq(track->timestamp, request_time) || track->discard) {
fr_assert(track->packets > 0);
track->packets--;
-
- DEBUG3("Suppressing reply as we have a newer packet");
-
+ DEBUG3("Suppressing reply as we have a newer / conflicing packet from the same source");
track->discard = true;
goto setup_timer;
}
* "do not respond" reply for a period of time.
*/
if ((buffer_len == 1) || track->do_not_respond) {
+ DEBUG3("Not sending response to request - it is marked as 'do not respond'");
track->do_not_respond = true;
goto setup_timer;
}
packet_len = inst->app_io->write(child, track, request_time,
buffer, buffer_len, written);
if (packet_len <= 0) {
+ ERROR("Failed writing the reply - not sending any response on %s", name);
track->discard = true;
packet_expiry_timer(el->tl, fr_time_wrap(0), track);
return packet_len;
* the expiry timer at that point.
*/
if ((size_t) packet_len < buffer_len) {
+ DEBUG3("Partial write (%zd < %zu)", packet_len, buffer_len);
return packet_len;
}
* We're not tracking duplicates, so just expire
* the packet now.
*/
- if (!inst->app_io->track_duplicates) goto setup_timer;
+ if (!inst->app_io->track_duplicates) {
+ DEBUG3("Not tracking duplicates - expiring the request");
+ goto setup_timer;
+ }
/*
* Cache the reply packet if we're doing dedup.
* already filled out. So we don't do that twice.
*/
if (!track->reply) {
+ DEBUG3("Caching reply");
MEM(track->reply = talloc_memdup(track, buffer, buffer_len));
track->reply_len = buffer_len;
}