aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2017-08-07 15:41:50 +0200
committerAnders Svensson <[email protected]>2017-08-10 11:16:00 +0200
commitca68fe8c449a170f64fd9b41b710ac67966be2ee (patch)
tree46b83c7c5aad17cea084bda4bd9f3575ac1cca96 /lib/diameter/src
parent05e1764c1f7d079b5432bff11a792cdb31b00dcd (diff)
downloadotp-ca68fe8c449a170f64fd9b41b710ac67966be2ee.tar.gz
otp-ca68fe8c449a170f64fd9b41b710ac67966be2ee.tar.bz2
otp-ca68fe8c449a170f64fd9b41b710ac67966be2ee.zip
Don't update diameter_tcp state unnecessarily
Not with each setopts to re-activate the socket.
Diffstat (limited to 'lib/diameter/src')
-rw-r--r--lib/diameter/src/transport/diameter_tcp.erl27
1 files changed, 19 insertions, 8 deletions
diff --git a/lib/diameter/src/transport/diameter_tcp.erl b/lib/diameter/src/transport/diameter_tcp.erl
index ead4e7e72a..bda92d02f6 100644
--- a/lib/diameter/src/transport/diameter_tcp.erl
+++ b/lib/diameter/src/transport/diameter_tcp.erl
@@ -603,7 +603,7 @@ transition({P, Sock, Bin}, #transport{socket = Sock,
= S)
when P == ssl, true == B;
P == tcp ->
- recv(acc(Frag, Bin), S#transport{active = false});
+ recv(acc(Frag, Bin), S);
%% Capabilties exchange has decided on whether or not to run over TLS.
transition({diameter, {tls, Ref, Type, B}}, #transport{parent = Pid}
@@ -724,9 +724,14 @@ tls(accept, Sock, Opts) ->
recv({Msg, Rest}, S) -> %% have a complete message ...
recv(acc(Rest), message(recv, Msg, S));
-recv(Frag, S) -> %% or not
- start_fragment_timer(setopts(S#transport{frag = Frag,
- flush = false})).
+recv(Frag, #transport{recv = B,
+ socket = Sock,
+ module = M}
+ = S) -> %% or not
+ B andalso setopts(M, Sock),
+ start_fragment_timer(S#transport{frag = Frag,
+ flush = false,
+ active = B}).
%% acc/2
@@ -885,14 +890,20 @@ setopts(#transport{socket = Sock,
module = M}
= S)
when B, not A ->
- case setopts(M, Sock, [{active, once}]) of
- ok -> S#transport{active = true};
- X -> x({setopts, Sock, M, X}) %% possibly on peer disconnect
- end;
+ setopts(M, Sock),
+ S#transport{active = true};
setopts(S) ->
S.
+%% setopts/2
+
+setopts(M, Sock) ->
+ case setopts(M, Sock, [{active, once}]) of
+ ok -> ok;
+ X -> x({setopts, Sock, M, X}) %% possibly on peer disconnect
+ end.
+
%% portnr/2
portnr(gen_tcp, Sock) ->