aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2017-06-01 10:13:51 +0200
committerJohn Högberg <[email protected]>2017-06-01 15:47:55 +0200
commitae8d3bc9b32e95ce6f9a2da3b6ae961f04071c36 (patch)
tree081811fd84874d3ba7baac71118123f23f00c381 /erts
parenta748cafdc7063d9f181ba12088db6458793ced2f (diff)
downloadotp-ae8d3bc9b32e95ce6f9a2da3b6ae961f04071c36.tar.gz
otp-ae8d3bc9b32e95ce6f9a2da3b6ae961f04071c36.tar.bz2
otp-ae8d3bc9b32e95ce6f9a2da3b6ae961f04071c36.zip
Unconditionally clear IO buffers on send/shutdown errors
This fixes a bug where a send/shutdown error on an active-mode socket results in the port never being properly closed.
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/drivers/common/inet_drv.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c
index 1885338ce5..ebd13e6f05 100644
--- a/erts/emulator/drivers/common/inet_drv.c
+++ b/erts/emulator/drivers/common/inet_drv.c
@@ -10386,6 +10386,9 @@ static int tcp_send_or_shutdown_error(tcp_descriptor* desc, int err)
set_busy_port(desc->inet.port, 0);
}
+ tcp_clear_output(desc);
+ tcp_clear_input(desc);
+
/*
* We used to handle "expected errors" differently from unexpected ones.
* Now we handle all errors in the same way (unless the show_econnreset
@@ -10408,8 +10411,6 @@ static int tcp_send_or_shutdown_error(tcp_descriptor* desc, int err)
else
desc_close(INETP(desc));
} else {
- tcp_clear_output(desc);
- tcp_clear_input(desc);
tcp_close_check(desc);
erl_inet_close(INETP(desc));