mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
Fix regression causing the main loop to spin more frequently.
Addresses BIT-1266.
This commit is contained in:
parent
d9889d489f
commit
9cd85be308
2 changed files with 20 additions and 0 deletions
|
@ -77,6 +77,23 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return whether any file descriptors have been added to the set.
|
||||||
|
*/
|
||||||
|
bool Empty() const
|
||||||
|
{
|
||||||
|
return fds.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the greatest file descriptor of all that have been added to the
|
||||||
|
* set, or -1 if the set is empty.
|
||||||
|
*/
|
||||||
|
int Max() const
|
||||||
|
{
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int max;
|
int max;
|
||||||
std::set<int> fds;
|
std::set<int> fds;
|
||||||
|
|
|
@ -117,6 +117,9 @@ IOSource* Manager::FindSoonest(double* ts)
|
||||||
|
|
||||||
src->Clear();
|
src->Clear();
|
||||||
src->src->GetFds(&src->fd_read, &src->fd_write, &src->fd_except);
|
src->src->GetFds(&src->fd_read, &src->fd_write, &src->fd_except);
|
||||||
|
if ( src->fd_read.Empty() ) src->fd_read.Insert(0);
|
||||||
|
if ( src->fd_write.Empty() ) src->fd_write.Insert(0);
|
||||||
|
if ( src->fd_except.Empty() ) src->fd_except.Insert(0);
|
||||||
src->SetFds(&fd_read, &fd_write, &fd_except, &maxx);
|
src->SetFds(&fd_read, &fd_write, &fd_except, &maxx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue