mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 10:38:20 +00:00
Adapting attribute serialization when talking to Broccoli.
Broccoli doesn't support expressions, and we now no longer send them when serializing attributes. This is the Bro change mentioned in #606. It's needs a correspondinly modified Broccoli identifying itself as such, and it isn't tested yet ... Addresses #606.
This commit is contained in:
parent
01b4ea1f5d
commit
18d968adcd
4 changed files with 30 additions and 2 deletions
|
@ -481,7 +481,11 @@ bool Attributes::DoSerialize(SerialInfo* info) const
|
||||||
loop_over_list((*attrs), i)
|
loop_over_list((*attrs), i)
|
||||||
{
|
{
|
||||||
Attr* a = (*attrs)[i];
|
Attr* a = (*attrs)[i];
|
||||||
SERIALIZE_OPTIONAL(a->AttrExpr())
|
|
||||||
|
// Broccoli doesn't support expressions.
|
||||||
|
Expr* e = (! info->broccoli_peer) ? a->AttrExpr() : 0;
|
||||||
|
SERIALIZE_OPTIONAL(e);
|
||||||
|
|
||||||
if ( ! SERIALIZE(char(a->Tag())) )
|
if ( ! SERIALIZE(char(a->Tag())) )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -385,6 +385,9 @@ inline void RemoteSerializer::SetupSerialInfo(SerialInfo* info, Peer* peer)
|
||||||
peer->phase == Peer::RUNNING )
|
peer->phase == Peer::RUNNING )
|
||||||
info->new_cache_strategy = true;
|
info->new_cache_strategy = true;
|
||||||
|
|
||||||
|
if ( (peer->caps & Peer::BROCCOLI_PEER) )
|
||||||
|
info->broccoli_peer = true;
|
||||||
|
|
||||||
info->include_locations = false;
|
info->include_locations = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2113,6 +2116,9 @@ bool RemoteSerializer::HandshakeDone(Peer* peer)
|
||||||
if ( (peer->caps & Peer::NEW_CACHE_STRATEGY) )
|
if ( (peer->caps & Peer::NEW_CACHE_STRATEGY) )
|
||||||
Log(LogInfo, "peer supports keep-in-cache; using that", peer);
|
Log(LogInfo, "peer supports keep-in-cache; using that", peer);
|
||||||
|
|
||||||
|
if ( (peer->caps & Peer::BROCCOLI_PEER) )
|
||||||
|
Log(LogInfo, "peer is a Broccoli", peer);
|
||||||
|
|
||||||
if ( peer->logs_requested )
|
if ( peer->logs_requested )
|
||||||
log_mgr->SendAllWritersTo(peer->id);
|
log_mgr->SendAllWritersTo(peer->id);
|
||||||
|
|
||||||
|
@ -2365,6 +2371,9 @@ bool RemoteSerializer::ProcessSerialization()
|
||||||
current_peer->phase == Peer::RUNNING )
|
current_peer->phase == Peer::RUNNING )
|
||||||
info.new_cache_strategy = true;
|
info.new_cache_strategy = true;
|
||||||
|
|
||||||
|
if ( current_peer->caps & Peer::BROCCOLI_PEER )
|
||||||
|
info.broccoli_peer = true;
|
||||||
|
|
||||||
if ( ! forward_remote_state_changes )
|
if ( ! forward_remote_state_changes )
|
||||||
ignore_accesses = true;
|
ignore_accesses = true;
|
||||||
|
|
||||||
|
|
|
@ -198,6 +198,7 @@ protected:
|
||||||
static const int NO_CACHING = 2;
|
static const int NO_CACHING = 2;
|
||||||
static const int PID_64BIT = 4;
|
static const int PID_64BIT = 4;
|
||||||
static const int NEW_CACHE_STRATEGY = 8;
|
static const int NEW_CACHE_STRATEGY = 8;
|
||||||
|
static const int BROCCOLI_PEER = 16;
|
||||||
|
|
||||||
// Constants to remember to who did something.
|
// Constants to remember to who did something.
|
||||||
static const int NONE = 0;
|
static const int NONE = 0;
|
||||||
|
|
|
@ -15,6 +15,7 @@ public:
|
||||||
pid_32bit = false;
|
pid_32bit = false;
|
||||||
include_locations = true;
|
include_locations = true;
|
||||||
new_cache_strategy = false;
|
new_cache_strategy = false;
|
||||||
|
broccoli_peer = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SerialInfo(const SerialInfo& info)
|
SerialInfo(const SerialInfo& info)
|
||||||
|
@ -28,6 +29,7 @@ public:
|
||||||
pid_32bit = info.pid_32bit;
|
pid_32bit = info.pid_32bit;
|
||||||
include_locations = info.include_locations;
|
include_locations = info.include_locations;
|
||||||
new_cache_strategy = info.new_cache_strategy;
|
new_cache_strategy = info.new_cache_strategy;
|
||||||
|
broccoli_peer = info.broccoli_peer;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parameters that control serialization.
|
// Parameters that control serialization.
|
||||||
|
@ -46,6 +48,11 @@ public:
|
||||||
// If true, we support keeping objs in cache permanently.
|
// If true, we support keeping objs in cache permanently.
|
||||||
bool new_cache_strategy;
|
bool new_cache_strategy;
|
||||||
|
|
||||||
|
// If true, we're connecting to a Broccoli. If so, serialization
|
||||||
|
// specifics may be adapted for functionality Broccoli does not
|
||||||
|
// support.
|
||||||
|
bool broccoli_peer;
|
||||||
|
|
||||||
ChunkedIO::Chunk* chunk; // chunk written right before the serialization
|
ChunkedIO::Chunk* chunk; // chunk written right before the serialization
|
||||||
|
|
||||||
// Attributes set during serialization.
|
// Attributes set during serialization.
|
||||||
|
@ -70,6 +77,7 @@ public:
|
||||||
print = 0;
|
print = 0;
|
||||||
pid_32bit = false;
|
pid_32bit = false;
|
||||||
new_cache_strategy = false;
|
new_cache_strategy = false;
|
||||||
|
broccoli_peer = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnserialInfo(const UnserialInfo& info)
|
UnserialInfo(const UnserialInfo& info)
|
||||||
|
@ -86,6 +94,7 @@ public:
|
||||||
print = info.print;
|
print = info.print;
|
||||||
pid_32bit = info.pid_32bit;
|
pid_32bit = info.pid_32bit;
|
||||||
new_cache_strategy = info.new_cache_strategy;
|
new_cache_strategy = info.new_cache_strategy;
|
||||||
|
broccoli_peer = info.broccoli_peer;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parameters that control unserialization.
|
// Parameters that control unserialization.
|
||||||
|
@ -106,6 +115,11 @@ public:
|
||||||
// If true, we support keeping objs in cache permanently.
|
// If true, we support keeping objs in cache permanently.
|
||||||
bool new_cache_strategy;
|
bool new_cache_strategy;
|
||||||
|
|
||||||
|
// If true, we're connecting to a Broccoli. If so, serialization
|
||||||
|
// specifics may be adapted for functionality Broccoli does not
|
||||||
|
// support.
|
||||||
|
bool broccoli_peer;
|
||||||
|
|
||||||
// If a global ID already exits, of these policies is used.
|
// If a global ID already exits, of these policies is used.
|
||||||
enum {
|
enum {
|
||||||
Keep, // keep the old ID and ignore the new
|
Keep, // keep the old ID and ignore the new
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue