summaryrefslogtreecommitdiff
path: root/lib/kernel
diff options
context:
space:
mode:
authorMicael Karlberg <bmk@erlang.org>2022-04-29 12:38:01 +0200
committerMicael Karlberg <bmk@erlang.org>2022-04-29 12:38:01 +0200
commitff381011f21874323b0dbaa9f9727a17144cd7e9 (patch)
treea7ff0488db9261ecb32610b85406886861d6f9a6 /lib/kernel
parent065a9e19c240541df7413b15aa3dc22ebfcb6b5f (diff)
downloaderlang-ff381011f21874323b0dbaa9f9727a17144cd7e9.tar.gz
[kernel|gen-tcp-socket] Changed the behaviour of shutdown
The behaviour of shutdown was changed to be more compatible with the "old" gen_tcp (that is, gen_tcp used with inet_backend = inet, which is *currently* default). OTP-18080
Diffstat (limited to 'lib/kernel')
-rw-r--r--lib/kernel/src/gen_tcp_socket.erl12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/kernel/src/gen_tcp_socket.erl b/lib/kernel/src/gen_tcp_socket.erl
index 62c0150679..b6defafe83 100644
--- a/lib/kernel/src/gen_tcp_socket.erl
+++ b/lib/kernel/src/gen_tcp_socket.erl
@@ -1701,10 +1701,20 @@ handle_event(Type, Content, State, P_D) ->
%% Event handler helpers
-%% We only accept/perform shutdown when socket is 'connected'.
+%% We only accept/perform shutdown when socket is 'connected'
+%% We only accept/perform shutdown when socket is 'connected'
+%% (or closed_read | closed_write).
%% This is done to be "compatible" with the inet-driver!
handle_shutdown(#params{socket = Socket},
+ closed_write = _State,
+ read = How) ->
+ handle_shutdown2(Socket, closed_read_write, How);
+handle_shutdown(#params{socket = Socket},
+ closed_read = _State,
+ write = How) ->
+ handle_shutdown2(Socket, closed_read_write, How);
+handle_shutdown(#params{socket = Socket},
connected = _State,
write = How) ->
{keep, socket:shutdown(Socket, How)};