aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded
diff options
context:
space:
mode:
authorRaimo Niskanen <[email protected]>2015-06-17 09:35:14 +0200
committerRaimo Niskanen <[email protected]>2015-06-17 09:35:14 +0200
commit5fc3d37e65d31dea7938750a3d75c7a1f7ebbd25 (patch)
treeee317fe2e3fd790976db7b4a8d20951fe72bb972 /erts/preloaded
parent828fbf8c9bd838280c1fc8a9f9da065aba2ada0e (diff)
parent485187dfdb5ec628efed755c88331ca296bc33dc (diff)
downloadotp-5fc3d37e65d31dea7938750a3d75c7a1f7ebbd25.tar.gz
otp-5fc3d37e65d31dea7938750a3d75c7a1f7ebbd25.tar.bz2
otp-5fc3d37e65d31dea7938750a3d75c7a1f7ebbd25.zip
Merge branch 'nybek/fix_so_linger_zero__simple'
* nybek/fix_so_linger_zero__simple: Update prim_inet.beam Fix socket option {linger, {true, 0}} to abort TCP connections Apply 'show_econnreset' socket option to send errors as well Add 'show_econnreset' TCP socket option
Diffstat (limited to 'erts/preloaded')
-rw-r--r--erts/preloaded/ebin/prim_inet.beambin73092 -> 72748 bytes
-rw-r--r--erts/preloaded/src/prim_inet.erl16
2 files changed, 12 insertions, 4 deletions
diff --git a/erts/preloaded/ebin/prim_inet.beam b/erts/preloaded/ebin/prim_inet.beam
index 6729f06b79..5a188be3ba 100644
--- a/erts/preloaded/ebin/prim_inet.beam
+++ b/erts/preloaded/ebin/prim_inet.beam
Binary files differ
diff --git a/erts/preloaded/src/prim_inet.erl b/erts/preloaded/src/prim_inet.erl
index 622e1be869..5e0b38aa68 100644
--- a/erts/preloaded/src/prim_inet.erl
+++ b/erts/preloaded/src/prim_inet.erl
@@ -146,11 +146,16 @@ shutdown_1(S, How) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
close(S) when is_port(S) ->
- case subscribe(S, [subs_empty_out_q]) of
- {ok, [{subs_empty_out_q,N}]} when N > 0 ->
- close_pend_loop(S, N); %% wait for pending output to be sent
+ case getopt(S, linger) of
+ {ok,{true,0}} ->
+ close_port(S);
_ ->
- close_port(S)
+ case subscribe(S, [subs_empty_out_q]) of
+ {ok, [{subs_empty_out_q,N}]} when N > 0 ->
+ close_pend_loop(S, N); %% wait for pending output to be sent
+ _ ->
+ close_port(S)
+ end
end.
close_pend_loop(S, N) ->
@@ -1140,6 +1145,7 @@ enc_opt(delay_send) -> ?INET_LOPT_TCP_DELAY_SEND;
enc_opt(packet_size) -> ?INET_LOPT_PACKET_SIZE;
enc_opt(read_packets) -> ?INET_LOPT_READ_PACKETS;
enc_opt(netns) -> ?INET_LOPT_NETNS;
+enc_opt(show_econnreset) -> ?INET_LOPT_TCP_SHOW_ECONNRESET;
enc_opt(raw) -> ?INET_OPT_RAW;
% Names of SCTP opts:
enc_opt(sctp_rtoinfo) -> ?SCTP_OPT_RTOINFO;
@@ -1197,6 +1203,7 @@ dec_opt(?INET_LOPT_TCP_DELAY_SEND) -> delay_send;
dec_opt(?INET_LOPT_PACKET_SIZE) -> packet_size;
dec_opt(?INET_LOPT_READ_PACKETS) -> read_packets;
dec_opt(?INET_LOPT_NETNS) -> netns;
+dec_opt(?INET_LOPT_TCP_SHOW_ECONNRESET) -> show_econnreset;
dec_opt(?INET_OPT_RAW) -> raw;
dec_opt(I) when is_integer(I) -> undefined.
@@ -1296,6 +1303,7 @@ type_opt_1(delay_send) -> bool;
type_opt_1(packet_size) -> uint;
type_opt_1(read_packets) -> uint;
type_opt_1(netns) -> binary;
+type_opt_1(show_econnreset) -> bool;
%%
%% SCTP options (to be set). If the type is a record type, the corresponding
%% record signature is returned, otherwise, an "elementary" type tag