diff options
Diffstat (limited to 'embassy-net')
| -rw-r--r-- | embassy-net/CHANGELOG.md | 2 | ||||
| -rw-r--r-- | embassy-net/src/tcp.rs | 14 |
2 files changed, 16 insertions, 0 deletions
diff --git a/embassy-net/CHANGELOG.md b/embassy-net/CHANGELOG.md index 1ae4f2a68..40f720d0d 100644 --- a/embassy-net/CHANGELOG.md +++ b/embassy-net/CHANGELOG.md | |||
| @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
| 8 | <!-- next-header --> | 8 | <!-- next-header --> |
| 9 | ## Unreleased - ReleaseDate | 9 | ## Unreleased - ReleaseDate |
| 10 | 10 | ||
| 11 | - tcp: Add `set_nagle_enabled()` to control TcpSocket nagle algorithm. | ||
| 12 | |||
| 11 | ## 0.7.1 - 2025-08-26 | 13 | ## 0.7.1 - 2025-08-26 |
| 12 | 14 | ||
| 13 | No unreleased changes yet... Quick, go send a PR! | 15 | No unreleased changes yet... Quick, go send a PR! |
diff --git a/embassy-net/src/tcp.rs b/embassy-net/src/tcp.rs index 6792c5526..b4db7b88c 100644 --- a/embassy-net/src/tcp.rs +++ b/embassy-net/src/tcp.rs | |||
| @@ -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. |
