Tunnel support performance optimization.

Looks better to allocate Encapsulation objects on-demand when tunnels
are discovered rather than always have an automatic, empty one for
every packet.
This commit is contained in:
Jon Siwek 2012-06-04 16:14:30 -05:00
parent 47c2fda88e
commit 9851591317
7 changed files with 110 additions and 65 deletions

View file

@ -52,17 +52,10 @@ class Analyzer;
class Connection : public BroObj {
public:
Connection(NetSessions* s, HashKey* k, double t, const ConnID* id,
uint32 flow, const Encapsulation& arg_encap);
uint32 flow, const Encapsulation* arg_encap);
virtual ~Connection();
void CheckEncapsulation(const Encapsulation& arg_encap)
{
if ( encapsulation != arg_encap )
{
Event(tunnel_changed, 0, arg_encap.GetVectorVal());
encapsulation = arg_encap;
}
}
void CheckEncapsulation(const Encapsulation* arg_encap);
// Invoked when connection is about to be removed. Use Ref(this)
// inside Done to keep the connection object around (though it'll
@ -254,7 +247,7 @@ public:
uint64 GetUID() const { return uid; }
const Encapsulation& GetEncapsulation() const
const Encapsulation* GetEncapsulation() const
{ return encapsulation; }
void CheckFlowLabel(bool is_orig, uint32 flow_label);
@ -294,7 +287,7 @@ protected:
double inactivity_timeout;
RecordVal* conn_val;
LoginConn* login_conn; // either nil, or this
Encapsulation encapsulation; // tunnels
const Encapsulation* encapsulation; // tunnels
int suppress_event; // suppress certain events to once per conn.
unsigned int installed_status_timer:1;