Preventing Bro processes that do neither local logging nor request

remote logs from spawning threads.

This applies to the proxy, which was still opening all the log files
with then idle threads.
This commit is contained in:
Robin Sommer 2012-04-05 15:30:40 -07:00
parent aa70ed592d
commit c63d23f3af

View file

@ -2503,6 +2503,9 @@ bool RemoteSerializer::SendLogCreateWriter(PeerID peer_id, EnumVal* id, EnumVal*
if ( peer->phase != Peer::HANDSHAKE && peer->phase != Peer::RUNNING ) if ( peer->phase != Peer::HANDSHAKE && peer->phase != Peer::RUNNING )
return false; return false;
if ( ! peer->logs_requested )
return false;
BinarySerializationFormat fmt; BinarySerializationFormat fmt;
fmt.StartWrite(); fmt.StartWrite();
@ -2625,6 +2628,9 @@ error:
bool RemoteSerializer::FlushLogBuffer(Peer* p) bool RemoteSerializer::FlushLogBuffer(Peer* p)
{ {
if ( ! p->logs_requested )
return false;
last_flush = network_time; last_flush = network_time;
if ( p->state == Peer::CLOSING ) if ( p->state == Peer::CLOSING )