anchor.diff:  cancel_pull(Mapping) ->
       %% after calling this function, queues never sent a new message.
       dict:map(fun(Id, {_, Pid}) -> lmq_queue:pull_cancel(Pid, Id) end, Mapping).
  -
  -get_timeout(#state{timeout=Timeout, end_time=EndTime}) ->
  -    case Timeout of
  -        0 -> infinity;
  -        _ -> round((EndTime - lmq_misc:unixtime()) * 1000)
  -    end.
  
positive.code: 
  waiting(Event, State) ->
      ?UNEXPECTED(Event, waiting),
      {reply, error, waiting, State, get_timeout(State)}.
  
  finalize(timeout, State) ->
      {stop, normal, State};
  
  finalize(Event, State) ->
      ?UNEXPECTED(Event, finalize),
      {reply, error, finalize, State, get_timeout(State)}.
  
  handle_info({Id, #message{}=M}, waiting, #state{mapping=Mapping}=S) ->
      {Name, _} = dict:fetch(Id, Mapping),
  
negative.code:                     Pid = lmq_queue_mgr:get(QName),
                      Id = lmq_queue:pull_async(Pid, S#state.timeout),
                      Mapping = dict:store(Id, {QName, Pid}, S#state.mapping),
                      {next_state, waiting, S#state{mapping=Mapping}};
                  _ ->
                      {next_state, waiting, S}
              end;
          {error, _} ->
              {next_state, waiting, S}
      end;
  
  waiting(cancel, #state{timeout=T}=S) when T > 0 ->
      waiting(timeout, S);
  
  waiting(timeout, #state{}=S) ->
      cancel_pull(S#state.mapping),
  