diff options
author | Zandra Hird <[email protected]> | 2015-06-02 15:40:58 +0200 |
---|---|---|
committer | Zandra Hird <[email protected]> | 2015-06-02 15:40:58 +0200 |
commit | b4774c9d55a1606a1abc726e0f7ce563065284b3 (patch) | |
tree | 8f6a8834dc96f5e47cab64da9337efbb90f076f1 /erts/preloaded/src | |
parent | 65bf43e82a8ec731aafdbac74d41d65b63c7f49c (diff) | |
parent | 25bd6312491fc9153a16f74b5d1d39609426ae60 (diff) | |
download | otp-b4774c9d55a1606a1abc726e0f7ce563065284b3.tar.gz otp-b4774c9d55a1606a1abc726e0f7ce563065284b3.tar.bz2 otp-b4774c9d55a1606a1abc726e0f7ce563065284b3.zip |
Merge branch 'nybek/fix_gen_tcp_shutdown'
OTP-12797
Diffstat (limited to 'erts/preloaded/src')
-rw-r--r-- | erts/preloaded/src/prim_inet.erl | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/erts/preloaded/src/prim_inet.erl b/erts/preloaded/src/prim_inet.erl index 79ff013c77..622e1be869 100644 --- a/erts/preloaded/src/prim_inet.erl +++ b/erts/preloaded/src/prim_inet.erl @@ -127,37 +127,18 @@ drv2protocol(_) -> undefined. %% TODO: shutdown equivalent for SCTP %% shutdown(S, read) when is_port(S) -> - shutdown_2(S, 0); + shutdown_1(S, 0); shutdown(S, write) when is_port(S) -> shutdown_1(S, 1); shutdown(S, read_write) when is_port(S) -> shutdown_1(S, 2). shutdown_1(S, How) -> - case subscribe(S, [subs_empty_out_q]) of - {ok,[{subs_empty_out_q,N}]} when N > 0 -> - shutdown_pend_loop(S, N); %% wait for pending output to be sent - _Other -> ok - end, - shutdown_2(S, How). - -shutdown_2(S, How) -> case ctl_cmd(S, ?TCP_REQ_SHUTDOWN, [How]) of {ok, []} -> ok; {error,_}=Error -> Error end. -shutdown_pend_loop(S, N0) -> - receive - {empty_out_q,S} -> ok - after ?INET_CLOSE_TIMEOUT -> - case getstat(S, [send_pend]) of - {ok,[{send_pend,N0}]} -> ok; - {ok,[{send_pend,N}]} -> shutdown_pend_loop(S, N); - _ -> ok - end - end. - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% CLOSE(insock()) -> ok |