diff --git a/src/Conn.cc b/src/Conn.cc index 36d45dd3b2..1c9a6247f4 100644 --- a/src/Conn.cc +++ b/src/Conn.cc @@ -273,8 +273,12 @@ const RecordValPtr& Connection::GetVal() conn_val->AssignTime(3, start_time); // ### conn_val->AssignInterval(4, last_time - start_time); - if ( history.size() ) - conn_val->Assign(6, history); + if ( ! history.empty() ) + { + auto v = conn_val->GetFieldAs(6); + if ( *v != history ) + conn_val->Assign(6, history); + } conn_val->SetOrigin(this); diff --git a/src/ZeekString.cc b/src/ZeekString.cc index d59c58ff24..3161cd2ef8 100644 --- a/src/ZeekString.cc +++ b/src/ZeekString.cc @@ -115,6 +115,11 @@ bool String::operator==(std::string_view s) const return (memcmp(b, s.data(), n) == 0); } +bool String::operator!=(std::string_view s) const + { + return ! (*this == s); + } + void String::Adopt(byte_vec bytes, int len) { Reset(); diff --git a/src/ZeekString.h b/src/ZeekString.h index e92574c2ec..1d129e0411 100644 --- a/src/ZeekString.h +++ b/src/ZeekString.h @@ -56,6 +56,7 @@ public: bool operator==(const String& bs) const; bool operator<(const String& bs) const; bool operator==(std::string_view s) const; + bool operator!=(std::string_view s) const; byte_vec Bytes() const { return b; } int Len() const { return n; }