-
Notifications
You must be signed in to change notification settings - Fork 447
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Radically simplify and optimize TCP packet dispatch.
This commit completely reworks packet dispatch in TCP sockets, and brings significant improvements to processing as well. In particular: * Challenge ACKs now do not reset retransmit timer; instead, TcpSocket::process directly returns a TcpRepr without altering any internal state at all. * Retransmit and close (aka TIME-WAIT) timers are unified and restructured into a enum that actually matches semantics of the timers. * If a packet cannot be emitted, no internal state is changed. * The dispatch of RST packets in case of connection abort is brought in line with dispatch of all other packets. * Packet dispatch now follows a series of steps with clean separation of concerns, like packet processing: 1. If we should retransmit, update state to assume that all in-flight packets are lost. 2. Prepare the packet that would be sent next, considering the in-flight packets, if any. 3. Check if the packet contains anything new, or it's the same as the one already in flight. If it is, bail. 4. Finalize and try to actually transmit the packet. If we can't do that, bail. 5. Update the internal state to reflect that the packet we've just sent is in flight.
1 parent
bf916e6
commit 72359cd
Showing
5 changed files
with
397 additions
and
359 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters