callbacks_.clear();
}
+std::list<int>
+IfaceMgr::getAllExternalSockets() {
+ std::list<int> result;
+ std::lock_guard<std::mutex> lock(callbacks_mutex_);
+ for (SocketCallbackInfo const& s : callbacks_) {
+ result.push_back(s.socket_);
+ }
+ return (result);
+}
+
void
IfaceMgr::setPacketFilter(const PktFilterPtr& packet_filter) {
// Do not allow null pointer.
boost::scoped_ptr<SocketCallbackInfo> ex_sock;
bool found = false;
{
+ std::list<SocketCallbackInfoIterator> to_reloc;
std::lock_guard<std::mutex> lock(callbacks_mutex_);
for (auto it = callbacks_.begin(); it != callbacks_.end(); ++it) {
if (it->unusable_) {
if (fd_event_handler_->readReady(it->socket_) ||
fd_event_handler_->hasError(it->socket_)) {
found = true;
+ to_reloc.push_back(it);
// something received over external socket
if (it->callback_) {
}
}
}
+ if (found) {
+ for (auto it : to_reloc) {
+ callbacks_.relocate(callbacks_.end(), it);
+ }
+ }
}
if (ex_sock && ex_sock->callback_) {
boost::scoped_ptr<SocketCallbackInfo> ex_sock;
bool found = false;
{
+ std::list<SocketCallbackInfoIterator> to_reloc;
std::lock_guard<std::mutex> lock(callbacks_mutex_);
for (auto it = callbacks_.begin(); it != callbacks_.end(); ++it) {
if (it->unusable_) {
if (fd_event_handler_->readReady(it->socket_) ||
fd_event_handler_->hasError(it->socket_)) {
found = true;
+ to_reloc.push_back(it);
// something received over external socket
if (it->callback_) {
}
}
}
+ if (found) {
+ for (auto it : to_reloc) {
+ callbacks_.relocate(callbacks_.end(), it);
+ }
+ }
}
if (ex_sock && ex_sock->callback_) {
boost::scoped_ptr<SocketCallbackInfo> ex_sock;
bool found = false;
{
+ std::list<SocketCallbackInfoIterator> to_reloc;
std::lock_guard<std::mutex> lock(callbacks_mutex_);
for (auto it = callbacks_.begin(); it != callbacks_.end(); ++it) {
if (it->unusable_) {
if (fd_event_handler_->readReady(it->socket_) ||
fd_event_handler_->hasError(it->socket_)) {
found = true;
+ to_reloc.push_back(it);
// something received over external socket
if (it->callback_) {
}
}
}
+ if (found) {
+ for (auto it : to_reloc) {
+ callbacks_.relocate(callbacks_.end(), it);
+ }
+ }
}
if (ex_sock && ex_sock->callback_) {
boost::scoped_ptr<SocketCallbackInfo> ex_sock;
bool found = false;
{
+ std::list<SocketCallbackInfoIterator> to_reloc;
std::lock_guard<std::mutex> lock(callbacks_mutex_);
for (auto it = callbacks_.begin(); it != callbacks_.end(); ++it) {
if (it->unusable_) {
if (fd_event_handler_->readReady(it->socket_) ||
fd_event_handler_->hasError(it->socket_)) {
found = true;
+ to_reloc.push_back(it);
// something received over external socket
if (it->callback_) {
}
}
}
+ if (found) {
+ for (auto it : to_reloc) {
+ callbacks_.relocate(callbacks_.end(), it);
+ }
+ }
}
if (ex_sock && ex_sock->callback_) {