diff options
| author | Raul Alimbekov <[email protected]> | 2025-12-16 09:05:22 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-12-16 09:05:22 +0300 |
| commit | c9a04b4b732b7a3b696eb8223664c1a7942b1875 (patch) | |
| tree | 6dbe5c02e66eed8d8762f13f95afd24f8db2b38c /embassy-net/src | |
| parent | cde24a3ef1117653ba5ed4184102b33f745782fb (diff) | |
| parent | 5ae6e060ec1c90561719aabdc29d5b6e7b8b0a82 (diff) | |
Merge branch 'main' into main
Diffstat (limited to 'embassy-net/src')
| -rw-r--r-- | embassy-net/src/icmp.rs | 2 | ||||
| -rw-r--r-- | embassy-net/src/lib.rs | 3 | ||||
| -rw-r--r-- | embassy-net/src/raw.rs | 2 | ||||
| -rw-r--r-- | embassy-net/src/tcp.rs | 18 | ||||
| -rw-r--r-- | embassy-net/src/udp.rs | 2 |
5 files changed, 21 insertions, 6 deletions
diff --git a/embassy-net/src/icmp.rs b/embassy-net/src/icmp.rs index 22c31a589..09e91a1ae 100644 --- a/embassy-net/src/icmp.rs +++ b/embassy-net/src/icmp.rs | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | //! ICMP sockets. | 1 | //! ICMP sockets. |
| 2 | 2 | ||
| 3 | use core::future::{poll_fn, Future}; | 3 | use core::future::{Future, poll_fn}; |
| 4 | use core::mem; | 4 | use core::mem; |
| 5 | use core::task::{Context, Poll}; | 5 | use core::task::{Context, Poll}; |
| 6 | 6 | ||
diff --git a/embassy-net/src/lib.rs b/embassy-net/src/lib.rs index 3f0634849..a49955c96 100644 --- a/embassy-net/src/lib.rs +++ b/embassy-net/src/lib.rs | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | #![no_std] | 1 | #![no_std] |
| 2 | #![allow(async_fn_in_trait)] | 2 | #![allow(async_fn_in_trait)] |
| 3 | #![allow(unsafe_op_in_unsafe_fn)] | ||
| 3 | #![warn(missing_docs)] | 4 | #![warn(missing_docs)] |
| 4 | #![doc = include_str!("../README.md")] | 5 | #![doc = include_str!("../README.md")] |
| 5 | 6 | ||
| @@ -26,7 +27,7 @@ mod time; | |||
| 26 | pub mod udp; | 27 | pub mod udp; |
| 27 | 28 | ||
| 28 | use core::cell::RefCell; | 29 | use core::cell::RefCell; |
| 29 | use core::future::{poll_fn, Future}; | 30 | use core::future::{Future, poll_fn}; |
| 30 | use core::mem::MaybeUninit; | 31 | use core::mem::MaybeUninit; |
| 31 | use core::pin::pin; | 32 | use core::pin::pin; |
| 32 | use core::task::{Context, Poll}; | 33 | use core::task::{Context, Poll}; |
diff --git a/embassy-net/src/raw.rs b/embassy-net/src/raw.rs index c9f753f13..89d2dd350 100644 --- a/embassy-net/src/raw.rs +++ b/embassy-net/src/raw.rs | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | //! Raw sockets. | 1 | //! Raw sockets. |
| 2 | 2 | ||
| 3 | use core::future::{poll_fn, Future}; | 3 | use core::future::{Future, poll_fn}; |
| 4 | use core::mem; | 4 | use core::mem; |
| 5 | use core::task::{Context, Poll}; | 5 | use core::task::{Context, Poll}; |
| 6 | 6 | ||
diff --git a/embassy-net/src/tcp.rs b/embassy-net/src/tcp.rs index d0230b581..b4db7b88c 100644 --- a/embassy-net/src/tcp.rs +++ b/embassy-net/src/tcp.rs | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | //! Incoming connections when no socket is listening are rejected. To accept many incoming | 8 | //! Incoming connections when no socket is listening are rejected. To accept many incoming |
| 9 | //! connections, create many sockets and put them all into listening mode. | 9 | //! connections, create many sockets and put them all into listening mode. |
| 10 | 10 | ||
| 11 | use core::future::{poll_fn, Future}; | 11 | use core::future::{Future, poll_fn}; |
| 12 | use core::mem; | 12 | use core::mem; |
| 13 | use core::task::{Context, Poll}; | 13 | use core::task::{Context, Poll}; |
| 14 | 14 | ||
| @@ -18,8 +18,8 @@ use smoltcp::socket::tcp; | |||
| 18 | pub use smoltcp::socket::tcp::State; | 18 | pub use smoltcp::socket::tcp::State; |
| 19 | use smoltcp::wire::{IpEndpoint, IpListenEndpoint}; | 19 | use smoltcp::wire::{IpEndpoint, IpListenEndpoint}; |
| 20 | 20 | ||
| 21 | use crate::time::duration_to_smoltcp; | ||
| 22 | use crate::Stack; | 21 | use crate::Stack; |
| 22 | use crate::time::duration_to_smoltcp; | ||
| 23 | 23 | ||
| 24 | /// Error returned by TcpSocket read/write functions. | 24 | /// Error returned by TcpSocket read/write functions. |
| 25 | #[derive(PartialEq, Eq, Clone, Copy, Debug)] | 25 | #[derive(PartialEq, Eq, Clone, Copy, Debug)] |
| @@ -373,6 +373,20 @@ impl<'a> TcpSocket<'a> { | |||
| 373 | self.io.with_mut(|s, _| s.set_hop_limit(hop_limit)) | 373 | self.io.with_mut(|s, _| s.set_hop_limit(hop_limit)) |
| 374 | } | 374 | } |
| 375 | 375 | ||
| 376 | /// Enable or disable Nagles's algorithm. | ||
| 377 | /// | ||
| 378 | /// By default, Nagle's algorithm is enabled. | ||
| 379 | /// When enabled, Nagle’s Algorithm prevents sending segments smaller | ||
| 380 | /// than MSS if there is data in flight (sent but not acknowledged). | ||
| 381 | /// In other words, it ensures at most only one segment smaller than | ||
| 382 | /// MSS is in flight at a time. | ||
| 383 | /// It ensures better network utilization by preventing sending many | ||
| 384 | /// very small packets, at the cost of increased latency in some | ||
| 385 | /// situations, particularly when the remote peer has ACK delay enabled. | ||
| 386 | pub fn set_nagle_enabled(&mut self, enabled: bool) { | ||
| 387 | self.io.with_mut(|s, _| s.set_nagle_enabled(enabled)) | ||
| 388 | } | ||
| 389 | |||
| 376 | /// Get the local endpoint of the socket. | 390 | /// Get the local endpoint of the socket. |
| 377 | /// | 391 | /// |
| 378 | /// Returns `None` if the socket is not bound (listening) or not connected. | 392 | /// Returns `None` if the socket is not bound (listening) or not connected. |
diff --git a/embassy-net/src/udp.rs b/embassy-net/src/udp.rs index 482eb0e56..448c25ecc 100644 --- a/embassy-net/src/udp.rs +++ b/embassy-net/src/udp.rs | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | //! UDP sockets. | 1 | //! UDP sockets. |
| 2 | 2 | ||
| 3 | use core::future::{poll_fn, Future}; | 3 | use core::future::{Future, poll_fn}; |
| 4 | use core::mem; | 4 | use core::mem; |
| 5 | use core::task::{Context, Poll}; | 5 | use core::task::{Context, Poll}; |
| 6 | 6 | ||
