aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2017-06-26 16:03:10 +0200
committerErlang/OTP <[email protected]>2017-06-26 16:03:10 +0200
commit5f2d536cb2ad0447eca64d91755dd8a4549561ac (patch)
treefac19ee80c52f21779da5977b68d02878e787fee /erts/emulator
parentb1f76e2f15c9d8c741ecb4bddc0b38740f3e7143 (diff)
parent02c0cf44437df3ed1ff8cdbb48b477b489977b85 (diff)
downloadotp-5f2d536cb2ad0447eca64d91755dd8a4549561ac.tar.gz
otp-5f2d536cb2ad0447eca64d91755dd8a4549561ac.tar.bz2
otp-5f2d536cb2ad0447eca64d91755dd8a4549561ac.zip
Merge branch 'john/erts/fix-port-leak/OTP-13939/ERL-193' into maint-19
* john/erts/fix-port-leak/OTP-13939/ERL-193: Add a testcase for OTP-13939/ERL-193 Mark socket disconnected on tcp_send_or_shutdown_error # Conflicts: # lib/kernel/test/gen_tcp_misc_SUITE.erl
Diffstat (limited to 'erts/emulator')
-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 ebd13e6f05..edea208857 100644
--- a/erts/emulator/drivers/common/inet_drv.c
+++ b/erts/emulator/drivers/common/inet_drv.c
@@ -4320,6 +4320,12 @@ static void desc_close(inet_descriptor* desc)
desc->event = INVALID_EVENT; /* closed by stop_select callback */
desc->s = INVALID_SOCKET;
desc->event_mask = 0;
+
+ /* mark as disconnected in case when socket is left lingering due to
+ * {exit_on_close, false} option in gen_tcp socket creation. Next
+ * write to socket should produce {error, enotconn} and send a
+ * message {tcp_error,#Port<>,econnreset} */
+ desc->state &= ~INET_STATE_CONNECTED;
}
}