-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
I'm trying to use libserard in my code. I successfully managed to send heartbeats. However, skis stopped moving when it came to receiving packets. Here's what I noticed: It seems the transfer structure is being used before initialization.
Lines 749 to 759 in 3950b9e
| ret = rxAcceptTransfer(ins, reassembler, out_transfer); | |
| if (ret == 1) | |
| { | |
| // copy the relevant metadata from the reassembler | |
| // because the transfer is valid, the application takes ownership | |
| // of the payload buffer. | |
| memcpy(&out_transfer->metadata, &reassembler->metadata, sizeof(struct SerardTransferMetadata)); | |
| out_transfer->payload_extent = reassembler->payload_extent; | |
| out_transfer->payload = reassembler->payload; | |
| out_transfer->timestamp_usec = reassembler->timestamp_usec; | |
| } |
It seems possible that reassembler should be used instead of transfer?
Line 666 in 3950b9e
| const struct SerardTransferMetadata* const metadata = &transfer->metadata; |
Also, the session state doesn't appear to be updating (only partially updating).
Lines 627 to 655 in 3950b9e
| SERARD_PRIVATE bool rxSessionUpdate(struct SerardRx* const ins, | |
| struct SerardInternalRxSession* const rxs, | |
| const struct SerardRxTransfer* const transfer, | |
| const SerardMicrosecond transfer_id_timeout_usec) | |
| { | |
| SERARD_ASSERT(ins != NULL); | |
| SERARD_ASSERT(rxs != NULL); | |
| SERARD_ASSERT(transfer != NULL); | |
| const struct SerardTransferMetadata* metadata = &transfer->metadata; | |
| // Accept the transfer if the new transfer ID is greater than the previous. | |
| const bool tid_future = metadata->transfer_id > rxs->transfer_id; | |
| // Accept (and restart the session) on transfer ID timeout. | |
| const bool tid_timed_out = (transfer->timestamp_usec > rxs->transfer_timestamp_usec) && | |
| ((transfer->timestamp_usec - rxs->transfer_timestamp_usec) > transfer_id_timeout_usec); | |
| // Accept if the transfer ID is at least TRANSFER_ID_DELTA counts less than | |
| // the previous one. This is used to hot-start the rx pipeline after a reboot. | |
| const bool wrap = !tid_future && ((rxs->transfer_id - metadata->transfer_id) >= TRANSFER_ID_DELTA); | |
| if (tid_timed_out) | |
| { | |
| rxs->transfer_id = metadata->transfer_id; | |
| } | |
| return tid_future || tid_timed_out || wrap; | |
| } |
Metadata
Metadata
Assignees
Labels
No labels