File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -77,17 +77,21 @@ void del_stream(uint32_t id) {
77
77
}
78
78
79
79
/**
80
- * @brief Clears the hash table of all streams and sets the pointer to NULL .
80
+ * @brief Clears all streams from the global hash table .
81
81
*
82
- * This function checks if the global variable `all_stream` is not NULL. If it is not NULL,
83
- * it clears the hash table using `HASH_CLEAR` and then sets `all_stream` to NULL.
82
+ * This function performs a complete cleanup of the global stream hash table.
83
+ * It safely handles the case where the hash table is already empty.
84
+ * After clearing, the global pointer is set to NULL to prevent dangling references.
85
+ *
86
+ * @note This function should be called during shutdown or when a complete reset is needed.
87
+ * @note This is a destructive operation - all stream entries will be removed.
84
88
*/
85
- void clear_stream () {
86
- if (! all_stream )
87
- return ;
88
-
89
- HASH_CLEAR ( hh , all_stream );
90
- all_stream = NULL ;
89
+ void clear_stream (void ) {
90
+ if (all_stream ) {
91
+ HASH_CLEAR ( hh , all_stream ) ;
92
+ all_stream = NULL ;
93
+ debug ( LOG_DEBUG , "Cleared all streams from hash table" );
94
+ }
91
95
}
92
96
93
97
/**
You can’t perform that action at this time.
0 commit comments