anchor.diff:                  remainder_data :: binary(),
                   free_writers :: ordsets:new(),
                   unacked_writes=ordsets:new(),
  +                next_block_id=0,
                   all_writer_pids :: list(pid())}).
   
   %%%===================================================================
  
positive.code: handle_accept_chunk(NewData, State=#state{buffer_queue=BufferQueue,
                                            remainder_data=RemainderData,
                                            num_bytes_received=PreviousBytesReceived,
                                            content_length=ContentLength,
                                            free_writers=FreeWriters,
                                            unacked_writes=UnackedWrites}) ->
      NewRemainderData = combine_new_and_remainder_data(NewData, RemainderData),
      UpdatedBytesReceived = PreviousBytesReceived + size(NewData),
  
      {NewBufferQueue, NewRemainderData2} =
      data_blocks(NewRemainderData, ContentLength, UpdatedBytesReceived, BufferQueue),
  
      {NewBufferQueue2, NewFreeWriters, NewUnackedWrites} =
      maybe_write_block(NewBufferQueue, FreeWriters, UnackedWrites),
  
      Reply = ok,
      {reply, Reply, not_full, State#state{buffer_queue=NewBufferQueue2,
                                           free_writers=NewFreeWriters,
                                           unacked_writes=NewUnackedWrites,
                                           remainder_data=NewRemainderData2}}.
  
  %% pattern match on reply_pid=undefined as a sort of
  %% assert
  
negative.code:                                                           buffer_queue=BufferQueue,
                                                            remainder_data=RemainderData,
                                                            num_bytes_received=PreviousBytesReceived,
                                                            content_length=ContentLength}) ->
  
      NewRemainderData = combine_new_and_remainder_data(NewData, RemainderData),
      UpdatedBytesReceived = PreviousBytesReceived + size(NewData),
  
      {NewBufferQueue, NewRemainderData2} =
      data_blocks(NewRemainderData, ContentLength, UpdatedBytesReceived, BufferQueue),
  
      NewStateData = maybe_write_blocks(State#state{buffer_queue=NewBufferQueue,
                                                    remainder_data=NewRemainderData2,
                                                    num_bytes_received=UpdatedBytesReceived}),
  
      {noreply, full, NewStateData#state{reply_pid=From}}.
  
  handle_receiving_last_chunk(NewData, State=#state{buffer_queue=BufferQueue,
                                                    remainder_data=RemainderData,
                                                    num_bytes_received=PreviousBytesReceived,
                                                    content_length=ContentLength}) ->
  
      NewRemainderData = combine_new_and_remainder_data(NewData, RemainderData),
      UpdatedBytesReceived = PreviousBytesReceived + size(NewData),
  
      {NewBufferQueue, NewRemainderData2} =
      data_blocks(NewRemainderData, ContentLength, UpdatedBytesReceived, BufferQueue),
  
      NewStateData = maybe_write_blocks(State#state{buffer_queue=NewBufferQueue,
                                                    remainder_data=NewRemainderData2,
                                                    num_bytes_received=UpdatedBytesReceived}),
  
      Reply = ok,
      {reply, Reply, all_received, NewStateData}.
  