Commit Graph

18 Commits

Author SHA1 Message Date
luojia65 c111bee3b6 Code format using `cargo fmt` 2021-10-27 16:35:05 +08:00
luojia65 a714def8d0 Add lint `#[must_use]` for ring buffer functions.
This lint is in stable Rust now: https://github.com/rust-lang/rust/issues/43302.
These changes are noted according to code comment from @whitequark.
Some test cases and functions are altered due to changes of #[must_use].
2021-10-27 16:26:57 +08:00
Thibaut Vandervelden 6a27136047 Fix clippy lints 2021-08-18 16:05:50 +02:00
Dario Nieuwenhuis 98fe17890a rustfmt 2021-06-27 09:31:59 +02:00
Ryan Summers 421870ee75 Restructuring to allow-unused 2021-06-09 11:30:02 +02:00
Ryan Summers 2fb5880628 Fixing feature flag 2021-06-09 11:13:56 +02:00
Ryan Summers 84866f8f69 Updating packet buffer clear to be UDP-only 2021-05-31 18:07:19 +02:00
Ryan Summers fa77ddd836 Updating UDP close to clear RX/TX buffers 2021-05-31 18:04:02 +02:00
Dario Nieuwenhuis d64c8593f0 Add defmt logging support 2021-04-01 01:30:47 +02:00
Dario Nieuwenhuis c09ca370b2 Simplify Socket lifetimes 2021-01-09 01:59:02 +01:00
Dario Nieuwenhuis 88256dbdcf Update to Rust 2018. Fixes #271 2020-12-27 17:54:56 +01:00
Gary Guo 18b728ebba Fix packet buffer panic caused by large payload (#332)
When packet buffer's payload buffer does not have enough contiguous
window left, the ring buffer roll over uses an incorrect size
causing the ring buffer pointer not resetting to the head.

When the payload enqueued is larger than 1/2 of the payload ring
buffer, this bug will cause the slice returned by
`PacketBuffer::enqueue` to not match the requested size, and
trigger `debug_assert` in debug profile or size mismatch panic in
`copy_from_slice` when compiled in release profile.
2020-04-14 10:48:31 +02:00
Scott Mabin d7916c9a92 Add capacity methods to all sockets. 2019-11-05 23:07:12 +00:00
Kai Lüke 49e985a66e Implement peek functions for UDP sockets
This needed a peek function for the packet buffer.

Closes: #278
Approved by: whitequark
2019-02-28 00:58:33 +08:00
Dan Robertson 276acfb7ef Fix packet buffer enqueue logic error
The size of the contiguous window should be prioritized over the size of
the contiguous window if padding were added.

For example, given the following packet buffer:

  1   2     3
|---|----|------|

If 2 is used and 1 and 3 are empty, enqueing a buffer of size 4 should
be placed in contiguous window 3 and the size of 1 should not cause
any issues in enqueue.

Closes: #247
Approved by: whitequark
2018-06-21 21:04:50 +08:00
whitequark 485b46a5e6 fn PacketMetadata::empty() → const PacketMetadata::EMPTY.
Fixes #181.
2018-03-24 03:23:37 +00:00
whitequark 41de9c7ee0 Distinguish PacketBuffer running out of payload space and capacity.
This makes the behavior of UdpSocket resemble that of RawSocket.
2018-02-22 11:57:39 +00:00
whitequark c474d0c32e Factor out storage::PacketBuffer from socket::UdpSocket. 2018-02-22 11:34:58 +00:00