aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2017-10-18 11:46:27 +0200
committerLukas Larsson <[email protected]>2017-10-30 19:40:10 +0100
commit553896346c987d27958adc392940a3a197bbcdc4 (patch)
tree37aa3cb1d21d735e825ef8a63c1091d4b9730394 /erts
parent62db6a63625ef67d7474da1efc8d4f65bfd8c251 (diff)
downloadotp-553896346c987d27958adc392940a3a197bbcdc4.tar.gz
otp-553896346c987d27958adc392940a3a197bbcdc4.tar.bz2
otp-553896346c987d27958adc392940a3a197bbcdc4.zip
erts: tcp send should return {error,closed}
In the scenario where a gen_tcp:recv/2 detected an error, the next gen_tcp:send should get a closed error and not a enotconn error as was the case before.
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/drivers/common/inet_drv.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c
index 7b1f4a0e9c..767fec3c98 100644
--- a/erts/emulator/drivers/common/inet_drv.c
+++ b/erts/emulator/drivers/common/inet_drv.c
@@ -9813,6 +9813,12 @@ static int tcp_recv_closed(tcp_descriptor* desc)
set_busy_port(desc->inet.port, 0);
inet_reply_error_am(INETP(desc), am_closed);
DEBUGF(("tcp_recv_closed(%ld): busy reply 'closed'\r\n", port));
+ } else {
+ /* No blocking send op to reply to right now.
+ * If next op is a send, make sure it returns {error,closed}
+ * rather than {error,enotconn}.
+ */
+ desc->tcp_add_flags |= TCP_ADDF_DELAYED_CLOSE_SEND;
}
if (!desc->inet.active) {
/* We must cancel any timer here ! */