Skip to content

Commit

Permalink
docs: Document safety about socket count for embassy
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyGrondin committed Jul 5, 2024
1 parent 19efdf8 commit b7346db
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions edge-nal-embassy/src/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ impl<'d, D: Driver, const N: usize, const TX_SZ: usize, const RX_SZ: usize>
Tcp<'d, D, N, TX_SZ, RX_SZ>
{
/// Create a new `Tcp` instance for the provided Embassy networking stack, using the provided TCP buffers
///
/// # Safety
///
/// Ensure that the number of buffers `N` fits within StackResources<N> of
/// [embassy_net::Stack], while taking into account the sockets used for DHCP, DNS, etc. else
/// [smoltcp::iface::SocketSet] will panic with `adding a socket to a full SocketSet`.
pub fn new(stack: &'d Stack<D>, buffers: &'d TcpBuffers<N, TX_SZ, RX_SZ>) -> Self {
Self { stack, buffers }
}
Expand Down

0 comments on commit b7346db

Please sign in to comment.