Add db__msg_store_free() for freeing stored messages.
This commit is contained in:
parent
e3e8dc4ea4
commit
3e595d557e
@ -187,10 +187,26 @@ void db__msg_store_add(struct mosquitto_db *db, struct mosquitto_msg_store *stor
|
||||
}
|
||||
|
||||
|
||||
void db__msg_store_remove(struct mosquitto_db *db, struct mosquitto_msg_store *store)
|
||||
void db__msg_store_free(struct mosquitto_msg_store *store)
|
||||
{
|
||||
int i;
|
||||
|
||||
mosquitto__free(store->source_id);
|
||||
mosquitto__free(store->source_username);
|
||||
if(store->dest_ids){
|
||||
for(i=0; i<store->dest_id_count; i++){
|
||||
mosquitto__free(store->dest_ids[i]);
|
||||
}
|
||||
mosquitto__free(store->dest_ids);
|
||||
}
|
||||
mosquitto__free(store->topic);
|
||||
mosquitto_property_free_all(&store->properties);
|
||||
UHPA_FREE_PAYLOAD(store);
|
||||
mosquitto__free(store);
|
||||
}
|
||||
|
||||
void db__msg_store_remove(struct mosquitto_db *db, struct mosquitto_msg_store *store)
|
||||
{
|
||||
if(store->prev){
|
||||
store->prev->next = store->next;
|
||||
if(store->next){
|
||||
@ -205,18 +221,7 @@ void db__msg_store_remove(struct mosquitto_db *db, struct mosquitto_msg_store *s
|
||||
db->msg_store_count--;
|
||||
db->msg_store_bytes -= store->payloadlen;
|
||||
|
||||
mosquitto__free(store->source_id);
|
||||
mosquitto__free(store->source_username);
|
||||
if(store->dest_ids){
|
||||
for(i=0; i<store->dest_id_count; i++){
|
||||
mosquitto__free(store->dest_ids[i]);
|
||||
}
|
||||
mosquitto__free(store->dest_ids);
|
||||
}
|
||||
mosquitto__free(store->topic);
|
||||
mosquitto_property_free_all(&store->properties);
|
||||
UHPA_FREE_PAYLOAD(store);
|
||||
mosquitto__free(store);
|
||||
db__msg_store_free(store);
|
||||
}
|
||||
|
||||
|
||||
|
@ -666,6 +666,7 @@ void db__msg_store_ref_inc(struct mosquitto_msg_store *store);
|
||||
void db__msg_store_ref_dec(struct mosquitto_db *db, struct mosquitto_msg_store **store);
|
||||
void db__msg_store_clean(struct mosquitto_db *db);
|
||||
void db__msg_store_compact(struct mosquitto_db *db);
|
||||
void db__msg_store_free(struct mosquitto_msg_store *store);
|
||||
int db__message_reconnect_reset(struct mosquitto_db *db, struct mosquitto *context);
|
||||
void sys_tree__init(struct mosquitto_db *db);
|
||||
void sys_tree__update(struct mosquitto_db *db, int interval, time_t start_time);
|
||||
|
Loading…
Reference in New Issue
Block a user