anchor.diff:              S#transport{frag = B};
           Frag ->
               setopts(M, Sock),
  -            S#transport{frag = Frag}
  +            start_fragment_timer(S#transport{frag = Frag})
       end;
   
   %% Incoming message.
  
positive.code:   when P == tcp, not B;
         P == ssl, B ->
      setopts(M, Sock),
      recv(Bin, S);
  
  %% Capabilties exchange has decided on whether or not to run over TLS.
  transition({diameter, {tls, Ref, Type, B}}, #transport{parent = Pid}
  
negative.code: %% since all messages with length problems are discarded this should
  %% also eventually lead to watchdog failover.
  
  %% No fragment to flush.
  flush(#transport{frag = <<>>} = S) ->
      S;
  
  %% Messages have been received since last timer expiry.
  flush(#transport{flush = false} = S) ->
      start_fragment_timer(S#transport{flush = true});
  
  %% No messages since last expiry.
  flush(#transport{frag = Frag, parent = Pid} = S) ->
      diameter_peer:recv(Pid, bin(Frag)),
      S#transport{frag = <<>>}.
  
  %% start_fragment_timer/1
  %%
  %% Start a timer only if there's none running and a message to flush.
  
  start_fragment_timer(#transport{frag = B, tref = TRef} = S)
    when B == <<>>;
         TRef /= false ->
      S;
  
  start_fragment_timer(#transport{timeout = Tmo} = S) ->
      S#transport{tref = erlang:start_timer(Tmo, self(), flush)}.
  
  %% accept/2
  
  