Skip to content

Conversation

SimenZhor
Copy link
Contributor

Hi, and thanks for maintaining this crate!

I needed client side support for block-wise transfers for observe notifications, so I thought I'd see if you'd be interested in these changes upstream as well. I'm not communicating with a server that's using this crate, so I haven't touched the server side of the code at all. Let me know if you need anything changed!

  • Set up synchronized transport before observe registration (to prevent losing first packet).
  • Ensure that CoAP messages are populated with tokens.
    • "fixed" token for long-lived receiver in observe loop.
    • new token per block-wise datagram (all blocks in a datagram use the same token)
  • Split out blockwise handling to more reusable components.
  • Some formatting changes (by cargo fmt)
  • Basic unit tests of new features

- Set up synchronized transport before observe registration (to
prevent losing first packet).
- Ensure that CoAP messages are populated with tokens.
  - "fixed" token for long-lived receiver in observe loop.
  - new token per block-wise datagram (all blocks in a datagram
    use the same token)
- Split out blockwise handling to more reusable components.
- Some formatting changes (by `cargo fmt`)
- Basic unit tests of new features
@coveralls
Copy link

coveralls commented Aug 16, 2025

Coverage Status

coverage: 82.832% (+0.6%) from 82.27%
when pulling f63bf17 on SimenZhor:client-blockwise-observe
into 3850dc2 on Covertness:master.

- Add more basic unit tests to client, request and server.
@SimenZhor
Copy link
Contributor Author

I've now created a separate function to generate random tokens instead of re-using gen_message_id.

I've also tried to investigate why my changes caused a drop in code coverage, and I think it's mostly because of the cargo fmt induced changes. Some calls that were previously on a single line have been broken into several lines, and the coverage tool doesn't seem to discover that all these lines are part of the same execution (?).

I did however notice some low hanging fruit while investigating, so I added a few very basic unit tests in the request.rs and server.rs test modules that should slightly improve coverage of those files.

@Covertness Covertness merged commit 5679c66 into Covertness:master Aug 21, 2025
3 checks passed
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.

3 participants