anchor.diff:                        socket = LSock}
              = S) ->
       ok = accept_peer(Sock, Matches),
  -    transition(Msg, S#transport{socket = Sock});
  +    transition(setelement(2, Msg, Sock), S#transport{socket = Sock});
   
   %% Incoming message.
  -transition({sctp, _Sock, _RA, _RP, Data}, #transport{socket = Sock} = S) ->
  +transition({sctp, Sock, _RA, _RP, Data}, #transport{socket = Sock} = S) ->
       setopts(Sock),
       recv(Data, S);
  -%% Don't match on Sock since in R15B01 it can be the listening socket
  -%% in the (peeled-off) accept case, which is likely a bug.
   
   %% Outgoing message.
   transition({diameter, {send, Msg}}, S) ->
  
positive.code:     diameter_peer:up(Pid),
      S#transport{mode = A}.
  
  %% find/3
  
  find(Id, Data, #listener{tmap = T} = S) ->
      f(ets:lookup(T, Id), Data, S).
  
  %% New association ...
  f([],
    {_, #sctp_assoc_change{state = comm_up, assoc_id = Id}},
    #listener{pending = {N,Q}}
    = S) ->
      {find(Id, S), S#listener{pending = {N+1,Q}}};
  
  %% Known association ...
  f([{_, TPid}], _, S) ->
      {TPid, S};
  
  %% ... or not: discard.
  f([], _, _) ->
      false.
  
  %% find/2
  
  %% Transport waiting for an association: use it.
  find(Id, #listener{tmap = T,
                     pending = {N,Q}})
    when N < 0 ->
      TPid = ets:first(Q),
      [{TPid, MRef}] = ets:lookup(T, TPid),
      ets:insert(T, [{MRef, Id}, {Id, TPid}]),
      ets:delete(T, TPid),
      ets:delete(Q, TPid),
      TPid;
  
  %% No transport start yet: spawn one and queue.
  find(Id, #listener{ref = Ref,
                     socket = Sock,
                     tmap = T,
                     pending = {_,Q}}) ->
      Arg = {accept, Ref, self(), Sock, Id},
      {ok, TPid} = diameter_sctp_sup:start_child(Arg),
      MRef = monitor(process, TPid),
      ets:insert(T, [{MRef, Id}, {Id, TPid}]),
      ets:insert(Q, {TPid, now()}),
      TPid.
  
  %% assoc_id/1
  
  assoc_id({[#sctp_sndrcvinfo{assoc_id = Id}], _}) ->
      Id;
  
negative.code: l({timeout, _, close}, #listener{} = S) ->
      S.
  
  %% down/3
  %%
  %% Accepting transport has died.
  
  %% One that's waiting for transport start in the pending queue ...
  down(true, TPid, #listener{pending = {N,Q},
                             count = K}
                   = S) ->
      ets:delete(Q, TPid),
      if N < 0 ->  %% awaiting an association ...
              start_timer(S#listener{count = K-1,
                                     pending = {N+1,Q}});
         true ->   %% ... or one has been assigned
              S#listener{pending = {N-1,Q}}
      end;
  
  %% ... or one that's already attached.
  down(false, _TPid, #listener{count = K} = S) ->
      start_timer(S#listener{count = K-1}).
  
  %% t/2
  %%
  