Add Broker::peer_counts_as_iosource option

Disabling this option allows one to read pcaps, but still initiate
Broker peerings and automatically exit when done processing the pcap
file.  The default behavior would normally cause Broker::peer() to
prevent shutting the process down even after done reading the pcap.
This commit is contained in:
Jon Siwek 2019-01-16 19:03:07 -06:00
parent 5eab9b9d47
commit 0d685efbf5
6 changed files with 49 additions and 10 deletions

View file

@ -318,8 +318,11 @@ void Manager::Peer(const string& addr, uint16_t port, double retry)
auto secs = broker::timeout::seconds(static_cast<uint64>(retry));
bstate->endpoint.peer_nosync(addr, port, secs);
// // Register as a "does-count" source now.
iosource_mgr->Register(this, false);
auto counts_as_iosource = get_option("Broker::peer_counts_as_iosource")->AsBool();
if ( counts_as_iosource )
// Register as a "does-count" source now.
iosource_mgr->Register(this, false);
}
void Manager::Unpeer(const string& addr, uint16_t port)