anchor.diff:      diameter_stats:read(lists:append(Peers)).
   %% TODO: include peer identities in return value
   
  -info_transport(#state{peerT = PeerT, connT = ConnT}) ->
  -    dict:fold(fun it/3,
  +%% info_transport/1
  +%%
  +%% One entry per configured transport. Statistics for each entry are
  +%% the accumulated values for the ref and associated peer pids.
  +
  +info_transport(S) ->
  +    PeerD = peer_dict(S),
  +    RefsD = dict:map(fun(_, Ls) -> [P || L <- Ls, {peer, {P,_}} <- L] end,
  +                     PeerD),
  +    Refs = lists:append(dict:fold(fun(R, Ps, A) -> [[R|Ps] | A] end,
  +                                  [],
  +                                  RefsD)),
  +    Stats = diameter_stats:read(Refs),
  +    dict:fold(fun(R, Ls, A) ->
  +                      Ps = dict:fetch(R, RefsD),
  +                      [[{ref, R} | transport(Ls)] ++ [stats([R|Ps], Stats)]
  +                       | A]
  +              end,
                 [],
  -              ets:foldl(fun(T,A) -> it_acc(ConnT, A, T) end,
  -                        dict:new(),
  -                        PeerT)).
  -
  -it(Ref, [[{type, connect} | _] = L], Acc) ->
  -    [[{ref, Ref} | L] | Acc];
  -it(Ref, [[{type, accept}, {options, Opts} | _] | _] = L, Acc) ->
  -    [[{ref, Ref},
  -      {type, listen},
  -      {options, Opts},
  -      {accept, [lists:nthtail(2,A) || A <- L]}]
  -     | Acc].
  -%% Each entry has the same Opts. (TODO)
  -
  -it_acc(ConnT, Acc, #peer{pid = Pid,
  -                         type = Type,
  -                         ref = Ref,
  -                         options = Opts,
  -                         op_state = OS,
  -                         started = T,
  -                         conn = TPid}) ->
  +              PeerD).
  +
  +transport([[{type, connect} | _] = L]) ->
  +    L;
  +
  +transport([[{type, accept}, {options, Opts} | _] | _] = Ls) ->
  +    [{type, listen},
  +     {options, Opts},
  +     {accept, [lists:nthtail(2,L) || L <- Ls]}].
  +%% Note that all peer records for a listening transport (ie. same Ref)
  +%% have the same options. (TODO)
  +
  +peer_dict(#state{peerT = PeerT, connT = ConnT}) ->
  +    ets:foldl(fun(T,A) -> peer_acc(ConnT, A, T) end, dict:new(), PeerT).
  +
  +peer_acc(ConnT, Acc, #peer{pid = Pid,
  +                           type = Type,
  +                           ref = Ref,
  +                           options = Opts,
  +                           op_state = OS,
  +                           started = T,
  +                           conn = TPid}) ->
       WS = wd_state(OS),
       dict:append(Ref,
                   [{type, Type},
  
positive.code:      {dictionary, Dict},
       {module, ModX},
       {id, Id}].
  
  info_pending(#state{} = S) ->
      MatchSpec = [{{'$1',
  
negative.code: info_conn([] = No) ->
      No.
  
  %% Use the fields names from diameter_caps instead of
  %% diameter_base_CER to distinguish between the 2-tuple values
  %% compared to the single capabilities values. Note also that the
  %% returned list is tagged 'caps' rather than 'capabilities' to
  %% emphasize the difference.
  info_caps(#diameter_caps{} = C) ->
      lists:zip(record_info(fields, diameter_caps), tl(tuple_to_list(C))).
  
  