aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2014-12-01 14:53:16 +0100
committerAnders Svensson <[email protected]>2014-12-01 14:53:16 +0100
commitef8c0f5cc93ed988e1919a53b6b6689c73e72eb4 (patch)
treec19e20ab5715684ef4ad053b27c538ad42e43ebd /lib
parent5a053f10425a6c517c113c375d6306f9716bfe31 (diff)
parentae92510847831609b12673be1d70106b395a2f36 (diff)
downloadotp-ef8c0f5cc93ed988e1919a53b6b6689c73e72eb4.tar.gz
otp-ef8c0f5cc93ed988e1919a53b6b6689c73e72eb4.tar.bz2
otp-ef8c0f5cc93ed988e1919a53b6b6689c73e72eb4.zip
Merge branch 'anders/diameter/request_leak/OTP-12196' into maint
* anders/diameter/request_leak/OTP-12196: Fix remote diameter_request table leak
Diffstat (limited to 'lib')
-rw-r--r--lib/diameter/src/base/diameter_traffic.erl23
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/diameter/src/base/diameter_traffic.erl b/lib/diameter/src/base/diameter_traffic.erl
index 280d09d7e8..e4812f3dc9 100644
--- a/lib/diameter/src/base/diameter_traffic.erl
+++ b/lib/diameter/src/base/diameter_traffic.erl
@@ -1632,12 +1632,23 @@ send_request(TPid, #diameter_packet{} = Pkt, Req, SvcName, Timeout) ->
%% send/1
-send({TPid, Pkt, #request{handler = Pid} = Req, SvcName, Timeout, TRef}) ->
- Ref = send_request(TPid,
- Pkt,
- Req#request{handler = self()},
- SvcName,
- Timeout),
+send({TPid, Pkt, #request{handler = Pid} = Req0, SvcName, Timeout, TRef}) ->
+ Seqs = diameter_codec:sequence_numbers(Pkt),
+ Req = Req0#request{handler = self()},
+ Ref = send_request(TPid, Pkt, Req, SvcName, Timeout),
+
+ try
+ recv(TPid, Pid, TRef, Ref)
+ after
+ %% Remove only the entry for this specific send since a resend
+ %% from the originating node can pick another transport on
+ %% this one.
+ ets:delete_object(?REQUEST_TABLE, {Seqs, Req, Ref})
+ end.
+
+%% recv/4
+
+recv(TPid, Pid, TRef, Ref) ->
receive
{answer, _, _, _, _} = A ->
Pid ! A;