anchor.diff:           handle_event/3, handle_sync_event/4, handle_info/3,
            terminate/3, code_change/4]).
   
  --record(state, {count, mll, body, msgs}).
  +-record(state, {count = 0, mll = <<>>, body = <<>>, msgs = []}).
   
   -include("meeqo_config.hrl").
   
  --define(SOCKOPT, [{binary, {active, false}, {packet, 4},
  +-define(SOCKOPT, [binary, {active, false}, {packet, 4},
                     {recbuf, ?PIPE_BUF},
                     {sndbuf, ?PIPE_BUF}
                    ]).
  
positive.code: code_change(_OldVsn, StateName, State, _Extra) ->
      {ok, StateName, State}.
  
  concat(#state{msgs = []} = State) -> State;
  concat({N, MLL, Body, [Msg|More]} = State) ->
      L = meeqo_msg:encode_length(byte_size(Msg)),
      NewMLL = <<MLL/binary, L/binary>>,
      NewBody = <<Body/binary, Msg/binary>>,
      NewState = State#state{count=N+1, mll=NewMLL, body=NewBody, msgs=More},
      case byte_size(NewMLL) + byte_size(NewBody) of
          X when X >= ?PARC_MAX_MEM -> {NewState, full};
          _ -> case (N + 1) of
              ?PARC_MAX_MSG -> {NewState, full};
              _ -> concat(NewState)
          end
      end.
  
  
negative.code:     Parc = <<ProxyPort:16, MLLBytes:32, MLL/binary, Body/binary>>,
      Sock = get(sock),
      gen_tcp:send(Sock, Parc),
      {ok, <<"ok", _/binary>>} = gen_tcp:recv(Sock, 0),
      Sluice = get(sluice),
      case Msgs of
          [] ->
              gen_server:cast(Sluice, sent),
              {next_state, empty, #state{}, 30000};
          _ ->
              gen_server:cast(Sluice, {sent, self()}),
              concat(#state{msgs = Msgs})
      end;
  handle_event(_Event, StateName, State) ->
      {next_state, StateName, State}.
  
  