anchor.diff:                  Id = lmq_queue:pull_async(Pid, Timeout),
                   dict:store(Id, Q, Acc)
               end, dict:new(), Queues),
  +            gen_fsm:send_event_after(Timeout, cancel),
               State = S#state{from=From, regexp=Regexp, timeout=Timeout,
  -                            mapping=Mapping,
  -                            end_time=lmq_misc:unixtime()+Timeout/1000},
  -            {next_state, waiting, State, get_timeout(State)}
  +                            mapping=Mapping},
  +            {next_state, waiting, State}
       end;
   
   idle(Event, _From, State) ->
       ?UNEXPECTED(Event, idle),
  -    {reply, error, idle, State, get_timeout(State)}.
  +    {reply, error, idle, State}.
   
   waiting({maybe_pull, QName}, #state{}=S) ->
       case re:compile(S#state.regexp) of
  
positive.code: 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.
  
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),
  