diff --git a/src/etcp.c b/src/etcp.c index e282a76..9760aec 100644 --- a/src/etcp.c +++ b/src/etcp.c @@ -748,8 +748,8 @@ void etcp_output_try_assembly(struct ETCP_CONN* etcp) { if (queue_data_put(etcp->output_queue, (struct ll_entry*)rx_pkt, next_expected_id) == 0) { delivered_bytes += rx_pkt->ll.len; delivered_count++; - DEBUG_TRACE(DEBUG_CATEGORY_ETCP, "[%s] moved packet id=%u to output_queue", etcp->log_name, - next_expected_id); + DEBUG_TRACE(DEBUG_CATEGORY_ETCP, "[%s] moved packet id=%u to output_queue (qlen=%d)", etcp->log_name, + next_expected_id, etcp->output_queue->count); } else { DEBUG_ERROR(DEBUG_CATEGORY_ETCP, "[%s] failed to add packet id=%u to output_queue", etcp->log_name, next_expected_id); diff --git a/src/pkt_normalizer.c b/src/pkt_normalizer.c index 2028405..66b4097 100644 --- a/src/pkt_normalizer.c +++ b/src/pkt_normalizer.c @@ -291,6 +291,7 @@ static void pn_flush_cb(void* arg) { // Internal: Unpacker callback (assembles fragments into original packets) static void pn_unpacker_cb(struct ll_queue* q, void* arg) { + DEBUG_TRACE(DEBUG_CATEGORY_NORMALIZER, ""); struct PKTNORM* pn = (struct PKTNORM*)arg; if (!pn) return; @@ -302,13 +303,14 @@ static void pn_unpacker_cb(struct ll_queue* q, void* arg) { uint8_t* payload = frag->ll.dgram; uint16_t len = frag->ll.len; uint16_t ptr = 0; - // DEBUG_INFO(DEBUG_CATEGORY_NORMALIZER, "pn_unpacker: unpacking fragment len=%d", len); + DEBUG_DEBUG(DEBUG_CATEGORY_NORMALIZER, "unpacking fragment len=%d", len); while (ptr < len) { if (!pn->recvpart) { // Need length header for new packet if (len - ptr < 2) { // Incomplete header, reset + DEBUG_ERROR(DEBUG_CATEGORY_NORMALIZER, "reset state"); pn_unpacker_reset_state(pn); break; } @@ -318,7 +320,7 @@ static void pn_unpacker_cb(struct ll_queue* q, void* arg) { pn->recvpart = ll_alloc_lldgram(part_size); if (!pn->recvpart) { - DEBUG_ERROR(DEBUG_CATEGORY_NORMALIZER, "pn_unpacker_cb: ll_alloc_lldgram failed"); + DEBUG_ERROR(DEBUG_CATEGORY_NORMALIZER, "ll_alloc_lldgram failed"); break; } pn->recvpart->len = 0; @@ -327,12 +329,13 @@ static void pn_unpacker_cb(struct ll_queue* q, void* arg) { uint16_t rem = pn->recvpart->memlen - pn->recvpart->len;// осталось собрать байт uint16_t avail = len - ptr;// доступно байт сейчас uint16_t cp = (rem < avail) ? rem : avail; - // DEBUG_INFO(DEBUG_CATEGORY_NORMALIZER, "pn_unpacker: copy: remain=%d avail=%d in_ptr=%d out_ptr=%d", rem, avail, ptr, pn->recvpart->len); + DEBUG_DEBUG(DEBUG_CATEGORY_NORMALIZER, "copy: remain=%d avail=%d in_ptr=%d out_ptr=%d", rem, avail, ptr, pn->recvpart->len); memcpy(pn->recvpart->dgram + pn->recvpart->len, payload + ptr, cp); pn->recvpart->len += cp; ptr += cp; if (pn->recvpart->len == pn->recvpart->memlen) { + DEBUG_DEBUG(DEBUG_CATEGORY_NORMALIZER, "unpacked dgram (size=%d)", pn->recvpart->len); queue_data_put(pn->output, pn->recvpart, 0); pn->recvpart = NULL; }