diff options
| author | PancakeTAS <pancake@mgnet.work> | 2026-06-13 15:21:33 +0200 |
|---|---|---|
| committer | PancakeTAS <pancake@mgnet.work> | 2026-06-14 16:27:15 +0200 |
| commit | 2b9c2960b0fcdf618d0f148cea3bea89c1af6c3b (patch) | |
| tree | fb4f0137377c0e4f753cc2362775983c37194868 | |
| parent | feat: Implement two-path UDP context (diff) | |
fix(mpu): Purge dropped packets from reorder heap
| -rw-r--r-- | src/mpu.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -94,8 +94,6 @@ int mpu_send(mpu_ctx_t* ctx, const uint8_t* data, size_t len) { return 0; } -// FIXME: Skipped packages are never purged - // TODO: Zero-copy recv() into reorder buffer slot, requiring the user to provide a callback // for processing received packets, instead of copying into a user buffer. @@ -137,6 +135,10 @@ ssize_t mpu_recv(mpu_ctx_t* ctx, uint8_t* data, size_t len) { } mpu_slot_t* slot = (mpu_slot_t*) node->user; + if (slot->packet.hdr.seq_num < ctx->recv_seq_num) { + heap_extract(&ctx->reorder_heap); + continue; + } int age = (int) (now - slot->timestamp); if (age < ctx->reorder_window) { |
