mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 17:18:20 +00:00
Make sure to always delete the remote serializer.
There were two problems actually: the iomanager wasn't properly deleting sourcesl; and in some situations, the remote serialize wasn't registered with it to begin with. Addresses BIT-1306 and probably also BIT-1356.
This commit is contained in:
parent
1132470b05
commit
0620bc970a
5 changed files with 36 additions and 4 deletions
9
CHANGES
9
CHANGES
|
@ -1,4 +1,13 @@
|
|||
|
||||
2.3-690 | 2015-04-10 21:51:10 -0700
|
||||
|
||||
* Make sure to always delete the remote serializer. Addresses
|
||||
BIT-1306 and probably also BIT-1356. (Robin Sommer)
|
||||
|
||||
* Cleaning up --help. -D and -Y/y were still listed, even though
|
||||
they had no effect anymore. Removing some dead code along with -D.
|
||||
Addresses BIT-1372. (Robin Sommer)
|
||||
|
||||
2.3-688 | 2015-04-10 08:10:44 -0700
|
||||
|
||||
* Update SQLite to 3.8.8.3.
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
2.3-688
|
||||
2.3-690
|
||||
|
|
|
@ -542,6 +542,9 @@ RemoteSerializer::RemoteSerializer()
|
|||
current_msgtype = 0;
|
||||
current_args = 0;
|
||||
source_peer = 0;
|
||||
|
||||
// Register as a "dont-count" source first, we may change that later.
|
||||
iosource_mgr->Register(this, true);
|
||||
}
|
||||
|
||||
RemoteSerializer::~RemoteSerializer()
|
||||
|
@ -571,8 +574,6 @@ void RemoteSerializer::Enable()
|
|||
|
||||
Fork();
|
||||
|
||||
iosource_mgr->Register(this);
|
||||
|
||||
Log(LogInfo, fmt("communication started, parent pid is %d, child pid is %d", getpid(), child_pid));
|
||||
initialized = 1;
|
||||
}
|
||||
|
@ -612,6 +613,9 @@ void RemoteSerializer::Fork()
|
|||
if ( child_pid )
|
||||
return;
|
||||
|
||||
// Register as a "does-count" source now.
|
||||
iosource_mgr->Register(this, false);
|
||||
|
||||
// If we are re-forking, remove old entries
|
||||
loop_over_list(peers, i)
|
||||
RemovePeer(peers[i]);
|
||||
|
|
|
@ -24,6 +24,7 @@ Manager::~Manager()
|
|||
for ( SourceList::iterator i = sources.begin(); i != sources.end(); ++i )
|
||||
{
|
||||
(*i)->src->Done();
|
||||
delete (*i)->src;
|
||||
delete *i;
|
||||
}
|
||||
|
||||
|
@ -183,9 +184,24 @@ finished:
|
|||
|
||||
void Manager::Register(IOSource* src, bool dont_count)
|
||||
{
|
||||
// First see if we already have registered that source. If so, just
|
||||
// adjust dont_count.
|
||||
for ( SourceList::iterator i = sources.begin(); i != sources.end(); ++i )
|
||||
{
|
||||
if ( (*i)->src == src )
|
||||
{
|
||||
if ( (*i)->dont_count != dont_count )
|
||||
// Adjust the global counter.
|
||||
dont_counts += (dont_count ? 1 : -1);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
src->Init();
|
||||
Source* s = new Source;
|
||||
s->src = src;
|
||||
s->dont_count = dont_count;
|
||||
if ( dont_count )
|
||||
++dont_counts;
|
||||
|
||||
|
|
|
@ -29,7 +29,9 @@ public:
|
|||
~Manager();
|
||||
|
||||
/**
|
||||
* Registers an IOSource with the manager.
|
||||
* Registers an IOSource with the manager. If the source is already
|
||||
* registered, the method will update its *dont_count* value but not
|
||||
* do anything else.
|
||||
*
|
||||
* @param src The source. The manager takes ownership.
|
||||
*
|
||||
|
@ -117,6 +119,7 @@ private:
|
|||
FD_Set fd_read;
|
||||
FD_Set fd_write;
|
||||
FD_Set fd_except;
|
||||
bool dont_count;
|
||||
|
||||
bool Ready(fd_set* read, fd_set* write, fd_set* except) const
|
||||
{ return fd_read.Ready(read) || fd_write.Ready(write) ||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue