mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 02:28:21 +00:00
Merge remote-tracking branch 'origin/topic/jsiwek/improve_comm_loop'
* origin/topic/jsiwek/improve_comm_loop: Add a simple FD_Set wrapper/helper class. Fix Pipe copy/assignment to make a copy of flags. Fix possible abort on writing to a full pipe. Remove timeouts from remote communication loop.
This commit is contained in:
commit
e9692958f0
22 changed files with 448 additions and 65 deletions
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include "iosource/FD_Set.h"
|
||||
|
||||
namespace iosource {
|
||||
|
||||
|
@ -44,7 +45,7 @@ public:
|
|||
* may block for a little while if all are dry.
|
||||
*
|
||||
* @param ts A pointer where to store the timestamp of the input that
|
||||
* the soonest source has available next.
|
||||
* the soonest source has available next.
|
||||
*
|
||||
* @return The source, or null if no source has input.
|
||||
*/
|
||||
|
@ -113,9 +114,19 @@ private:
|
|||
|
||||
struct Source {
|
||||
IOSource* src;
|
||||
int fd_read;
|
||||
int fd_write;
|
||||
int fd_except;
|
||||
FD_Set fd_read;
|
||||
FD_Set fd_write;
|
||||
FD_Set fd_except;
|
||||
|
||||
bool Ready(fd_set* read, fd_set* write, fd_set* except) const
|
||||
{ return fd_read.Ready(read) || fd_write.Ready(write) ||
|
||||
fd_except.Ready(except); }
|
||||
|
||||
void SetFds(fd_set* read, fd_set* write, fd_set* except,
|
||||
int* maxx) const;
|
||||
|
||||
void Clear()
|
||||
{ fd_read.Clear(); fd_write.Clear(); fd_except.Clear(); }
|
||||
};
|
||||
|
||||
typedef std::list<Source*> SourceList;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue