layer2: update comments, use constant

This commit is contained in:
Simon Ruderich 2024-07-23 09:15:34 +02:00
parent 8aacbaf8c3
commit b3a49fe0ba

View file

@ -51,7 +51,7 @@ result_t layer2_tx_fill_packet_queue(layer2_tx_t *ctx)
header.tx_request = 0; header.tx_request = 0;
while(packet_queue_get_free_space(&ctx->packet_queue) > 0) { while(packet_queue_get_free_space(&ctx->packet_queue) > 0) {
int ret = poll(&pfd, 1, 0); int ret = poll(&pfd, 1, 0 /* timeout */);
if(ret < 0) { if(ret < 0) {
LOG(LVL_ERR, "poll: %s", strerror(errno)); LOG(LVL_ERR, "poll: %s", strerror(errno));
return ERR_SYSCALL; return ERR_SYSCALL;
@ -75,7 +75,7 @@ result_t layer2_tx_fill_packet_queue(layer2_tx_t *ctx)
free(packetbuf); free(packetbuf);
return ERR_SYSCALL; return ERR_SYSCALL;
} else if(ret == 0) { } else if(ret == 0) {
// no more data // no more data, should not happen
free(packetbuf); free(packetbuf);
break; break;
} }
@ -128,7 +128,7 @@ size_t layer2_tx_encode_next_packet(layer2_tx_t *ctx, uint8_t ack_seq_nr, uint8_
unsigned int crc_size = crc_sizeof_key(PAYLOAD_CRC_SCHEME); unsigned int crc_size = crc_sizeof_key(PAYLOAD_CRC_SCHEME);
assert(buf_len >= 18 + crc_size + entry->data_len); assert(buf_len >= LAYER2_PACKET_HEADER_ENCODED_SIZE_MAX + crc_size + entry->data_len);
layer2_packet_header_t header = entry->header; layer2_packet_header_t header = entry->header;
header.rx_seq_nr = ack_seq_nr; header.rx_seq_nr = ack_seq_nr;