aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded
diff options
context:
space:
mode:
authorRaimo Niskanen <[email protected]>2019-02-15 13:25:23 +0100
committerRaimo Niskanen <[email protected]>2019-02-15 13:25:23 +0100
commit9b93a26e8bda8b5e5bb9cd0a1925d3a2d435cb6c (patch)
tree1cad7c34641151a2182a9175af59e1c6298a465a /erts/preloaded
parent595c159823089d0186ec2617c174356d1ff2de65 (diff)
parente23b1ad7f296ae18cae143cdafcdaff044cee9f3 (diff)
downloadotp-9b93a26e8bda8b5e5bb9cd0a1925d3a2d435cb6c.tar.gz
otp-9b93a26e8bda8b5e5bb9cd0a1925d3a2d435cb6c.tar.bz2
otp-9b93a26e8bda8b5e5bb9cd0a1925d3a2d435cb6c.zip
Merge branch 'raimo/erts/gen_tcp-listen-linger-slow/ERIERL-303/OTP-14728' into maint
* raimo/erts/gen_tcp-listen-linger-slow/ERIERL-303/OTP-14728: Check empty_out_q at close also for linger Conflicts: erts/preloaded/ebin/prim_inet.beam
Diffstat (limited to 'erts/preloaded')
-rw-r--r--erts/preloaded/ebin/prim_inet.beambin82260 -> 82620 bytes
-rw-r--r--erts/preloaded/src/prim_inet.erl16
2 files changed, 13 insertions, 3 deletions
diff --git a/erts/preloaded/ebin/prim_inet.beam b/erts/preloaded/ebin/prim_inet.beam
index 33b9f490b7..d3614d5f16 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 1d2fa767fd..2820a5bef4 100644
--- a/erts/preloaded/src/prim_inet.erl
+++ b/erts/preloaded/src/prim_inet.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2000-2018. All Rights Reserved.
+%% Copyright Ericsson AB 2000-2019. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -172,8 +172,18 @@ close(S) when is_port(S) ->
%% and is a contradiction in itself.
%% We have hereby done our best...
%%
- Tref = erlang:start_timer(T * 1000, self(), close_port),
- close_pend_loop(S, Tref, undefined);
+ case subscribe(S, [subs_empty_out_q]) of
+ {ok, [{subs_empty_out_q,0}]} ->
+ close_port(S);
+ {ok, [{subs_empty_out_q,N}]} when N > 0 ->
+ %% Wait for pending output to be sent
+ Tref = erlang:start_timer(T * 1000, self(), close_port),
+ close_pend_loop(S, Tref, N);
+ _ ->
+ %% Subscribe failed - wait full time
+ Tref = erlang:start_timer(T * 1000, self(), close_port),
+ close_pend_loop(S, Tref, undefined)
+ end;
_ -> % Regard this as {ok,{false,_}}
case subscribe(S, [subs_empty_out_q]) of
{ok, [{subs_empty_out_q,N}]} when N > 0 ->