mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-13 18:55:10 +01:00
Optimized zmq::dish_t::xhas_in
This commit is contained in:
parent
aa1f5739b7
commit
3cca90ea44
18
src/dish.cpp
18
src/dish.cpp
@ -207,9 +207,9 @@ bool zmq::dish_t::xhas_in ()
|
|||||||
if (_has_message)
|
if (_has_message)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
while (true) {
|
do {
|
||||||
// Get a message using fair queueing algorithm.
|
// Get a message using fair queueing algorithm.
|
||||||
int rc = _fq.recv (&_message);
|
const int rc = _fq.recv (&_message);
|
||||||
|
|
||||||
// If there's no message available, return immediately.
|
// If there's no message available, return immediately.
|
||||||
// The same when error occurs.
|
// The same when error occurs.
|
||||||
@ -218,14 +218,12 @@ bool zmq::dish_t::xhas_in ()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filtering non matching messages
|
// Filter out non matching messages
|
||||||
subscriptions_t::iterator it =
|
} while (0 == _subscriptions.count (std::string (_message.group ())));
|
||||||
_subscriptions.find (std::string (_message.group ()));
|
|
||||||
if (it != _subscriptions.end ()) {
|
// Matching message found
|
||||||
_has_message = true;
|
_has_message = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const zmq::blob_t &zmq::dish_t::get_credential () const
|
const zmq::blob_t &zmq::dish_t::get_credential () const
|
||||||
|
Loading…
Reference in New Issue
Block a user