diff options
author | Erlang/OTP <[email protected]> | 2017-06-30 15:20:44 +0200 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2017-06-30 15:20:44 +0200 |
commit | b2cd2f2c426d6ce02702e8318f86ee2c09b6e7ef (patch) | |
tree | 88e60599450194ec4344912aad889c34c2b44b94 /erts/emulator | |
parent | 040bdce67f88d833bfb59adae130a4ffb4c180f0 (diff) | |
parent | 02c0cf44437df3ed1ff8cdbb48b477b489977b85 (diff) | |
download | otp-b2cd2f2c426d6ce02702e8318f86ee2c09b6e7ef.tar.gz otp-b2cd2f2c426d6ce02702e8318f86ee2c09b6e7ef.tar.bz2 otp-b2cd2f2c426d6ce02702e8318f86ee2c09b6e7ef.zip |
Merge branch 'john/erts/fix-port-leak/OTP-13939/ERL-193' into maint-20
* 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.c | 6 |
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 13ee935e45..fe421bfe12 100644 --- a/erts/emulator/drivers/common/inet_drv.c +++ b/erts/emulator/drivers/common/inet_drv.c @@ -4334,6 +4334,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; } } |