diff --git a/CHANGES b/CHANGES index 9872c8bd71..2a1f852e09 100644 --- a/CHANGES +++ b/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. diff --git a/VERSION b/VERSION index 9a0e965233..eb1820b417 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.3-688 +2.3-690 diff --git a/src/RemoteSerializer.cc b/src/RemoteSerializer.cc index 9756e0b0ae..08b7fe9fbf 100644 --- a/src/RemoteSerializer.cc +++ b/src/RemoteSerializer.cc @@ -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]); diff --git a/src/iosource/Manager.cc b/src/iosource/Manager.cc index f71807dcbe..fccdbadb4a 100644 --- a/src/iosource/Manager.cc +++ b/src/iosource/Manager.cc @@ -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; diff --git a/src/iosource/Manager.h b/src/iosource/Manager.h index fb4f6676b6..e25b940bca 100644 --- a/src/iosource/Manager.h +++ b/src/iosource/Manager.h @@ -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) ||