]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Pull request #4822: appid: change appid_shadow_traffic_status to atomic for thread...
authorOleksandr Stepanov -X (ostepano - SOFTSERVE INC at Cisco) <ostepano@cisco.com>
Wed, 23 Jul 2025 19:30:54 +0000 (19:30 +0000)
committerChris Sherwin (chsherwi) <chsherwi@cisco.com>
Wed, 23 Jul 2025 19:30:54 +0000 (19:30 +0000)
Merge in SNORT/snort3 from ~OSTEPANO/snort3:shadow_traffic_tsan to master

Squashed commit of the following:

commit bc119724fa6f56ad57478fde14d31cf8e3e5511c
Author: Oleksandr Stepanov <ostepano@cisco.com>
Date:   Wed Jul 23 05:29:03 2025 -0400

    appid: change appid_shadow_traffic_status to atomic for thread safety

src/network_inspectors/appid/appid_config.h

index 9468fd12c819cf622df06f6d2ddcb9ff6fad3964..0bf4788dce3f9037243d7cc33ec0d097a49e6f0e 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef APP_ID_CONFIG_H
 #define APP_ID_CONFIG_H
 
+#include <atomic>
 #include <array>
 #include <memory>
 #include <string>
@@ -284,12 +285,12 @@ public:
 
     void set_appid_shadow_traffic_status(bool status)
     { 
-        appid_shadow_traffic_status = status
+        appid_shadow_traffic_status.store(status, std::memory_order_relaxed)
     }
 
     bool get_appid_shadow_traffic_status() const
     { 
-        return appid_shadow_traffic_status; 
+        return appid_shadow_traffic_status.load(std::memory_order_relaxed)
     }
  
     unsigned get_pattern_count();
@@ -327,7 +328,7 @@ private:
 
     uint32_t version;
     static uint32_t next_version;
-    bool appid_shadow_traffic_status = false;
+    std::atomic<bool> appid_shadow_traffic_status = false;
 };
 
 class OdpThreadContext