Browse Source

Add debug logging for request_id tracking and pending list dump

congestion
Evgeny 5 months ago
parent
commit
5b6455ccff
  1. 20
      src/route_ping.c

20
src/route_ping.c

@ -100,6 +100,19 @@ void route_ping_handle_resp(struct ROUTE_BGP* bgp, struct ETCP_CONN* from_conn,
}
DEBUG_WARN(DEBUG_CATEGORY_BGP, "request_id=%08x not found in pending list",
(unsigned)resp->request_id);
// Dump all pending entries for debugging
struct route_ping_pending* dump_cur = bgp->ping_pending;
int dump_count = 0;
while (dump_cur) {
DEBUG_WARN(DEBUG_CATEGORY_BGP, " pending[%d]: request_id=%08x via=%s",
dump_count, (unsigned)dump_cur->request_id,
dump_cur->via_conn ? dump_cur->via_conn->log_name : "NULL");
dump_cur = dump_cur->next;
dump_count++;
}
if (dump_count == 0) {
DEBUG_WARN(DEBUG_CATEGORY_BGP, " pending list is EMPTY");
}
}
void route_ping_cancel_for_conn(struct ROUTE_BGP* bgp, struct ETCP_CONN* conn) {
@ -164,7 +177,10 @@ int route_ping_send_req_addr(struct ROUTE_BGP* bgp, struct ETCP_CONN* to_conn,
}
req_pkt->cmd = ETCP_ID_ROUTE_ENTRY;
req_pkt->subcmd = ROUTE_SUBCMD_PING_REQ;
req_pkt->request_id = bgp->next_ping_req_id++;
uint32_t new_req_id = bgp->next_ping_req_id++;
req_pkt->request_id = new_req_id;
DEBUG_TRACE(DEBUG_CATEGORY_BGP, "assigned request_id=%08x (next was %08x)",
(unsigned)new_req_id, (unsigned)(new_req_id + 1));
req_pkt->count = count;
req_pkt->interval_ms = interval_ms;
req_pkt->timeout_ms = timeout_ms;
@ -199,6 +215,8 @@ int route_ping_send_req_addr(struct ROUTE_BGP* bgp, struct ETCP_CONN* to_conn,
}
pending->bgp = bgp;
pending->request_id = req_pkt->request_id;
DEBUG_TRACE(DEBUG_CATEGORY_BGP, "pending stored request_id=%08x (from req_pkt=%08x)",
(unsigned)pending->request_id, (unsigned)req_pkt->request_id);
pending->callback = cb;
pending->arg = arg;
pending->via_conn = to_conn;

Loading…
Cancel
Save