qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Conway <acon...@redhat.com>
Subject Re: I think this code is unnecessary...
Date Fri, 01 Feb 2013 20:45:59 GMT
On Fri, 2013-02-01 at 11:45 -0500, Andrew Stitcher wrote:
> In SemanticState.cpp:384
> 
> 
> bool SemanticStateConsumerImpl::filter(const Message& msg)
> {
>     return !selector || selector->filter(msg);
> }
> 
> bool SemanticStateConsumerImpl::accept(const Message& msg)
> {
>     // TODO aconway 2009-06-08: if we have byte & message credit but
>     // checkCredit fails because the message is to big, we should
>     // remain on queue's listener list for possible smaller messages
>     // in future.
>     //
>     blocked = !(filter(msg) && checkCredit(msg));
>     return !blocked;
> }
> 
> 
> -- Note that accept() itself uses filter().
> 
> However as far as I can tell the only use for this accept() is currently
> in Queue.cpp:386
> 
> 
> ...
>             if (c->filter(*msg)) {
>                 if (c->accept(*msg)) {
>                     if (c->preAcquires()) {
> ...
> 
> 
> So it seems that accept() can only be called when filter already
> returned true, so trying it again seems unnecessary.
> 
> Did I miss some important point here? I'd like to get rid of unnecessary
> filter() operations as if a selector is attached they could be costly.

Agreed that its duplicated effort, and we can remove the filter() call
in accept().



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


Mime
View raw message