Repository navigation
Commit f6164f8
authored
fix(net): queue TCP sends before namespace polling (#2723)
* fix(net): queue TCP sends before namespace polling
Admit established writes under the socket locks and hand accepted bytes
to the existing namespace worker. This avoids global polling and
socket notification scans on the ordinary write path. Keep protocol
assistance on the backpressure path, including a recheck before a
nonblocking send reports EAGAIN.
Give already queued data a chance to reach output before an established
close purges the send queue and emits a reset. Bound this work by the
existing poll budget and the closing socket's admission progress. Stop
when the peer window closes or output no longer advances.
Cover both zero linger and unread data at close with a loopback
regression that also verifies the resulting ECONNRESET.
Related to #2324.
Signed-off-by: longjin <longjin@dragonos.org>
* fix(net): deliver corked TCP data before close FIN
A successful corked write can leave bytes outside the smoltcp send
queue when the queue fills. Graceful close previously queued FIN and
unbound the socket immediately, so the peer could see EOF before it
received those bytes.
Serialize cork enqueue and consumption with close. Transfer the
remaining cork buffer to the existing deferred close entry and let it
queue the tail as ACKs free transport space. Queue FIN only once the
tail is in the transport queue. Abortive close and timeout still
discard the tail.
Keep poll publication outside the send locks and retain the
publish-only path for successful established writes. Add regression
coverage for both a short corked write and a backpressured send before
plain close.
Signed-off-by: longjin <longjin@dragonos.org>
---------
Signed-off-by: longjin <longjin@dragonos.org>1 parent 712d26b commit f6164f8
8 files changed
Lines changed: 355 additions & 199 deletions
File tree
- kernel
- crates/smoltcp/src/socket
- src/net
- socket/inet/stream
- user/apps/tests/dunitest/suites/normal
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2378 | 2378 | | |
2379 | 2379 | | |
2380 | 2380 | | |
| 2381 | + | |
| 2382 | + | |
| 2383 | + | |
| 2384 | + | |
| 2385 | + | |
| 2386 | + | |
| 2387 | + | |
| 2388 | + | |
| 2389 | + | |
| 2390 | + | |
| 2391 | + | |
2381 | 2392 | | |
2382 | 2393 | | |
2383 | 2394 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
12 | 13 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
| 14 | + | |
18 | 15 | | |
19 | 16 | | |
20 | 17 | | |
| |||
0 commit comments