anchor.diff:              end;
           %%
           {?MODULE, From, {send, Data}} ->
  -            case
  +            {SendParams_1, SendSeq_1, Result} =
                   encrypt_and_send_chunk(
  -                  SendParams, SendSeq, [?HANDSHAKE_CHUNK, Data])
  -            of
  -                {SendParams_1, SendSeq_1, ok} ->
  +                  SendParams, SendSeq, [?HANDSHAKE_CHUNK, Data]),
  +            if
  +                Result =:= ok ->
                       reply(From, ok),
                       handshake(
                         SendParams_1, SendSeq_1, RecvParams, RecvSeq,
                         Controller);
  -                {_, _, Error} ->
  +                true ->
                       reply(From, {error, closed}),
  -                    death_row({send, trace(Error)})
  +                    death_row({send, trace(Result)})
               end;
           {?MODULE, From, recv} ->
  -            case recv_and_decrypt_chunk(RecvParams, RecvSeq) of
  -                {RecvParams_1, RecvSeq_1, {ok, _} = Reply} ->
  -                    reply(From, Reply),
  +            {RecvParams_1, RecvSeq_1, Result} =
  +                recv_and_decrypt_chunk(RecvParams, RecvSeq),
  +            case Result of
  +                {ok, _} ->
  +                    reply(From, Result),
                       handshake(
                         SendParams, SendSeq, RecvParams_1, RecvSeq_1,
                         Controller);
  -                {_, _, Error} ->
  -                    reply(From, Error),
  -                    death_row({recv, trace(Error)})
  +                {error, _} ->
  +                    reply(From, Result),
  +                    death_row({recv, trace(Result)})
               end;
           {?MODULE, From, peername} ->
               reply(From, inet:peername(Socket)),
  
positive.code:             end
      end.
  
  output_handler_data(Params, Seq) ->
      receive
          Msg ->
  
negative.code: %%
  %% The game here is to flush all dist_data and dist_tick messages,
  %% prioritize dist_data over dist_tick, and to not use selective receive
  %% because that would hurt performance during overload
  
  output_handler(Params, Seq) ->
      receive
  