1
0
Fork 0

Logging fix

This commit is contained in:
Shawn Nock 2019-07-18 14:20:24 -04:00
parent 6e241ea8c1
commit 4f5029ed2e
1 changed files with 9 additions and 10 deletions

View File

@ -229,17 +229,16 @@ static void process_unack(void)
} }
*/ */
static void h5_print_header(h5_hdr_t *hdr, const char *str) static void h5_print_header(h5_hdr_t *hdr)
{ {
char const *label = str ? str : "";
if (hdr->is_reliable) { if (hdr->is_reliable) {
LOG_DBG("%s REL: seq %u ack %u crc %u type %u len %u", LOG_DBG("REL: seq %u ack %u crc %u type %u len %u",
label, hdr->seq, hdr->ack, hdr->seq, hdr->ack,
hdr->checksum, hdr->packet_type, hdr->checksum, hdr->packet_type,
hdr->len); hdr->len);
} else { } else {
LOG_DBG("%s UNREL: ack %u crc %u type %u len %u", LOG_DBG("UNREL: ack %u crc %u type %u len %u",
label, hdr->ack, hdr->checksum, hdr->ack, hdr->checksum,
hdr->packet_type, hdr->len); hdr->packet_type, hdr->len);
} }
} }
@ -525,13 +524,13 @@ static void unproc_thread(void) {
buf = net_buf_get(&h5.unprocessed_queue, K_FOREVER); buf = net_buf_get(&h5.unprocessed_queue, K_FOREVER);
h5_hdr_t hdr = {0}; h5_hdr_t hdr = {0};
int r; int r = pull_header1(buf, &hdr);
if ((r = pull_header1(buf, &hdr) < 0)) { if (r < 0) {
LOG_WRN("Bad h5 header: %d", r); LOG_WRN("Bad h5 header: %d, dropping packet", r);
goto next; goto next;
} }
h5_print_header(&hdr, "unproc_thread"); h5_print_header(&hdr);
struct net_buf *rx_buf = NULL; struct net_buf *rx_buf = NULL;