Skip to content

Tier 2: server block transfers + observe sequence check#39

Merged
cvik merged 5 commits intomainfrom
tier2-server-features
Mar 17, 2026
Merged

Tier 2: server block transfers + observe sequence check#39
cvik merged 5 commits intomainfrom
tier2-server-features

Conversation

@cvik
Copy link
Owner

@cvik cvik commented Mar 17, 2026

Summary

  • 2.4 Client observe sequence freshness check (RFC 7641 §3.4)
  • 2.2 Server-side Block2 — large response fragmentation (RFC 7959)
  • 2.3 Server-side Block1 — upload reassembly (RFC 7959)

Block transfers

  • Shared pre-allocated BlockTransfer pool (Config.max_block_transfers = 32)
  • Block1: transparent reassembly — handler sees complete payload only after all blocks arrive, 2.31 Continue for intermediates
  • Block2: handler returns full payload, server fragments on demand with SZX negotiation
  • Max upload/response size via Config.max_block_payload (default 64KB)
  • Timeout eviction in tick loop

Observe sequence

  • Client extracts Observe option from wire data, compares with last_seq
  • 24-bit wrap-around freshness check per §3.4, stale notifications dropped

Test plan

  • zig build test — all tests pass (12 new block transfer + existing)
  • No changes to handler interface — fn(Request) ?Response unchanged

Christoffer Vikström added 5 commits March 17, 2026 01:03
Use coapz Packet.peekKind/peekMsgId/peekOption/emptyAck/emptyRst
instead of inline bit manipulation. Removes 72 lines of duplicated
wire-format logic from Client.zig and Server.zig.
@cvik cvik merged commit b770e84 into main Mar 17, 2026
1 check passed
@cvik cvik deleted the tier2-server-features branch March 17, 2026 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant