From 043cb47a1967a63b316c7bd4cb4232f2e9b0f895 Mon Sep 17 00:00:00 2001
From: Micael Karlberg
Date: Tue, 30 Apr 2019 15:06:15 +0200
Subject: [esock|doc] Add text about the abort message
If another process closes the socket, the caller will
receive an abort message instead (of the select message).
OTP-15731
---
erts/doc/src/socket.xml | 16 ++++++++++++++--
erts/doc/src/socket_usage.xml | 13 ++++++++++++-
2 files changed, 26 insertions(+), 3 deletions(-)
(limited to 'erts/doc')
diff --git a/erts/doc/src/socket.xml b/erts/doc/src/socket.xml
index 3ff0eb4e1b..f9dd9575f4 100644
--- a/erts/doc/src/socket.xml
+++ b/erts/doc/src/socket.xml
@@ -44,15 +44,27 @@
Some functions allow for an asynchronous call.
This is achieved by setting the Timeout argument to
nowait. For instance, if calling the
- recv/3
+ recv/3
function with Timeout set to nowait (recv(Sock, 0, nowait))
when there is actually nothing to read, it will return with
{ok, SelectInfo}. When data eventually arrives a 'select' message
will be sent to the caller:
- {'$socket', Sock, select, Info}. The caller can now make another
+
+ - {'$socket', Sock, select, Info}
+
+ The caller can now make another
call to the recv function and now expect data.
Note that all other users are locked out until the
'current user' has called the function (recv in this case).
+ Another message the user must be prepared for (when making asynchronous
+ calls) is the abort message:
+
+ - {'$socket', Sock, abort, Reason}
+
+ This message indicates
+ that the (asynchronous) operation has been aborted.
+ If, for instance, the socket has been
+ closed (by another process), Reason will be {Ref, closed}.
There is currently no support for Windows.
diff --git a/erts/doc/src/socket_usage.xml b/erts/doc/src/socket_usage.xml
index 3d18bd1af7..fcfe9b54ec 100644
--- a/erts/doc/src/socket_usage.xml
+++ b/erts/doc/src/socket_usage.xml
@@ -56,8 +56,19 @@
when there is actually nothing to read, it will return with
{ok, SelectInfo}. When data eventually arrives a 'select message'
will be sent to the caller:
- {'$socket', Sock, select, Info}. The caller can make another
+
+ - {'$socket', Sock, select, Info}
+
+ The caller can then make another
call to the recv function and now expect data.
+ The user must also be prepared to receive an abort message:
+
+ - {'$socket', Sock, abort, Reason}
+
+ If the operation is aborted
+ for whatever reason (e.g. if the socket is closed "by someone else").
+ The Reason part contains the abort reason (in case the socket
+ has been closed Reason = {Ref, closed}).
Note that all other users are locked out until the
'current user' has called the function (recv in this case). So either
immediately call the function or
--
cgit v1.2.3