diff options
author | Anders Svensson <[email protected]> | 2016-04-20 11:04:26 +0200 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2016-05-04 23:45:16 +0200 |
commit | 2adc2c2385e849c5f5b55240cbf7b0e66d364e5c (patch) | |
tree | 647e5022fd2030a6c2e237f84a49a40bba1424b0 /lib/diameter/src/base/diameter_service.erl | |
parent | e15789aaf653543e4d7e0bcfdb769ffea67066c7 (diff) | |
download | otp-2adc2c2385e849c5f5b55240cbf7b0e66d364e5c.tar.gz otp-2adc2c2385e849c5f5b55240cbf7b0e66d364e5c.tar.bz2 otp-2adc2c2385e849c5f5b55240cbf7b0e66d364e5c.zip |
Add diameter:peer_info/1
To return information about a single peer_ref(), to avoid having to
retrieve more than is needed with service_info/2.
Diffstat (limited to 'lib/diameter/src/base/diameter_service.erl')
-rw-r--r-- | lib/diameter/src/base/diameter_service.erl | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/diameter/src/base/diameter_service.erl b/lib/diameter/src/base/diameter_service.erl index 87ef2e522d..de373b158f 100644 --- a/lib/diameter/src/base/diameter_service.erl +++ b/lib/diameter/src/base/diameter_service.erl @@ -32,6 +32,7 @@ -export([subscribe/1, unsubscribe/1, services/0, + peer_info/1, info/2]). %% towards diameter_config @@ -218,6 +219,29 @@ lookup_state(SvcName) -> end. %% --------------------------------------------------------------------------- +%% # peer_info/2 +%% --------------------------------------------------------------------------- + +%% An extended version of info_peer/1 for peer_info/1. +peer_info(Pid) -> + try + {_, PD} = process_info(Pid, dictionary), + {_, T} = lists:keyfind({diameter_peer_fsm, start}, 1, PD), + {TPid, {{Type, Ref}, TMod, Cfg}} = T, + {_, TD} = process_info(TPid, dictionary), + {_, Data} = lists:keyfind({TMod, info}, 1, TD), + [{ref, Ref}, + {type, Type}, + {owner, TPid}, + {module, TMod}, + {config, Cfg} + | try TMod:info(Data) catch _:_ -> [] end] + catch + error:_ -> + [] + end. + +%% --------------------------------------------------------------------------- %% # subscribe/1 %% # unsubscribe/1 %% --------------------------------------------------------------------------- |