From 45a64afabbe7b413a377a1c0cbb8786842a8357e Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 20 Dec 2018 12:51:21 +0100 Subject: [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 --- lib/kernel/doc/src/inet.xml | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'lib/kernel/doc/src/inet.xml') 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) -> {linger, {true|false, Seconds}} - +

Determines the time-out, in seconds, for flushing unsent data - in the close/1 socket call. If the first component of - the value tuple is false, the second is ignored. This - means that close/1 returns immediately, not waiting - for data to be flushed. Otherwise, the second component is - the flushing time-out, in seconds.

+ in the close/1 socket call.

+

The first component is if linger is enabled, the second component + is the flushing time-out, in seconds. There are 3 alternatives:

+ + {false, _} + +

close/1 or shutdown/2 returns immediately, + not waiting for data to be flushed, with closing + happening in the background.

+
+ {true, 0} + +

Aborts the connection when it is closed. + Discards any data still remaining in the send buffers + and sends RST to the peer.

+

This avoids TCP's TIME_WAIT state, but leaves open + the possibility that another "incarnation" of this connection + being created.

+
+ {true, Time} when Time > 0 + +

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.

+
+
{low_msgq_watermark, Size} -- cgit v1.2.3