diff options
author | Micael Karlberg <[email protected]> | 2018-12-20 12:51:21 +0100 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2018-12-20 12:51:21 +0100 |
commit | 45a64afabbe7b413a377a1c0cbb8786842a8357e (patch) | |
tree | 390d6ae853c093b6bacd81b167b311ef92a227a1 | |
parent | 4a97c51559959915774caeca249a527f5f3d8ec4 (diff) | |
download | otp-45a64afabbe7b413a377a1c0cbb8786842a8357e.tar.gz otp-45a64afabbe7b413a377a1c0cbb8786842a8357e.tar.bz2 otp-45a64afabbe7b413a377a1c0cbb8786842a8357e.zip |
[kernel|tcp] Improve the linger option documentation
The documentation for the tcp linger option was somewhat
obtuse. This has been improved upon by listing and describing
the three basic alternatives.
OTP-15491
-rw-r--r-- | lib/kernel/doc/src/inet.xml | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/lib/kernel/doc/src/inet.xml b/lib/kernel/doc/src/inet.xml index 104c698591..709ba8e8fd 100644 --- a/lib/kernel/doc/src/inet.xml +++ b/lib/kernel/doc/src/inet.xml @@ -1007,13 +1007,34 @@ get_tcpi_sacked(Sock) -> <marker id="option-linger"></marker> </item> <tag><c>{linger, {true|false, Seconds}}</c></tag> - <item> + <item> <p>Determines the time-out, in seconds, for flushing unsent data - in the <c>close/1</c> socket call. If the first component of - the value tuple is <c>false</c>, the second is ignored. This - means that <c>close/1</c> returns immediately, not waiting - for data to be flushed. Otherwise, the second component is - the flushing time-out, in seconds.</p> + in the <c>close/1</c> socket call. </p> + <p>The first component is if linger is enabled, the second component + is the flushing time-out, in seconds. There are 3 alternatives:</p> + <taglist> + <tag><c>{false, _}</c></tag> + <item> + <p>close/1 or shutdown/2 returns immediately, + not waiting for data to be flushed, with closing + happening in the background.</p> + </item> + <tag><c>{true, 0}</c></tag> + <item> + <p>Aborts the connection when it is closed. + Discards any data still remaining in the send buffers + and sends RST to the peer.</p> + <p>This avoids TCP's TIME_WAIT state, but leaves open + the possibility that another "incarnation" of this connection + being created.</p> + </item> + <tag><c>{true, Time} when Time > 0</c></tag> + <item> + <p>close/1 or shutdown/2 will not return until + all queued messages for the socket have been successfully + sent or the linger timeout (Time) has been reached.</p> + </item> + </taglist> </item> <tag><c>{low_msgq_watermark, Size}</c></tag> <item> |