aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2012-10-01 08:45:23 +0200
committerAnders Svensson <[email protected]>2012-10-01 08:45:23 +0200
commit08b325d1a4890ffe4f9ca5061f017384947a56f6 (patch)
treed904a2d0c08fff7d881c221bcfdbbfeedac7a65d
parent952db27ba0a5b87a2a47f3a7034a9bf92e3651e5 (diff)
downloadotp-08b325d1a4890ffe4f9ca5061f017384947a56f6.tar.gz
otp-08b325d1a4890ffe4f9ca5061f017384947a56f6.tar.bz2
otp-08b325d1a4890ffe4f9ca5061f017384947a56f6.zip
Send up event *after* inserting peer in table
Otherwise a request in response to an event can return error due to the peer not yet having been inserted.
-rw-r--r--lib/diameter/src/base/diameter_service.erl14
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/diameter/src/base/diameter_service.erl b/lib/diameter/src/base/diameter_service.erl
index 725cccda1e..131c5d9837 100644
--- a/lib/diameter/src/base/diameter_service.erl
+++ b/lib/diameter/src/base/diameter_service.erl
@@ -979,10 +979,9 @@ connection_up(T, P, C, #state{peerT = PeerT,
insert(PeerT, P#peer{op_state = {?STATE_UP, ?WD_OKAY}}),
request_peer_up(TPid),
+ insert_local_peer(SApps, {{TPid, Caps}, {SvcName, Apps}}, LDict),
report_status(up, P, C, S, T),
- S#state{local_peers = insert_local_peer(SApps,
- {{TPid, Caps}, {SvcName, Apps}},
- LDict)}.
+ S.
insert_local_peer(SApps, T, LDict) ->
lists:foldl(fun(A,D) -> ilp(A, T, D) end, LDict, SApps).
@@ -1058,12 +1057,9 @@ connection_down(#peer{conn = TPid,
local_peers = LDict}
= S) ->
report_status(down, P, C, S, []),
- NewS = S#state{local_peers
- = remove_local_peer(SApps,
- {{TPid, Caps}, {SvcName, Apps}},
- LDict)},
- request_peer_down(TPid, NewS),
- NewS.
+ remove_local_peer(SApps, {{TPid, Caps}, {SvcName, Apps}}, LDict),
+ request_peer_down(TPid, S),
+ S.
remove_local_peer(SApps, T, LDict) ->
lists:foldl(fun(A,D) -> rlp(A, T, D) end, LDict, SApps).