Don't send alert events without wc->host (#12547)
* if wc->host is null dont send events * we will always have wc->host * free claim_id
Emmanuel Vasilakis committed
Mar 30, 2022 at 13:39 UTC
dcf9679b109e8a334741dadf12ec26c3306f2015
1 file changed
+6
-1
database/sqlite/sqlite_aclk_alert.c
+6
-1
@@ -135,6 +135,11 @@ void aclk_push_alert_event(struct aclk_database_worker_config *wc, struct aclk_d
135
if (unlikely(!claim_id))
136
return;
137
138
+ if (unlikely(!wc->host)) {
139
+ freez(claim_id);
140
+ return;
141
+ }
142
+
143
BUFFER *sql = buffer_create(1024);
144
145
if (wc->alerts_start_seq_id != 0) {
@@ -269,7 +274,7 @@ void aclk_push_alert_event(struct aclk_database_worker_config *wc, struct aclk_d
274
db_execute(buffer_tostring(sql));
275
} else {
276
if (log_first_sequence_id)
272
- log_access("OG [%s (%s)]: Sent alert events, first sequence_id %"PRIu64", last sequence_id %"PRIu64, wc->node_id, wc->host ? wc->host->hostname : "N/A", log_first_sequence_id, log_last_sequence_id);
277
+ log_access("OG [%s (%s)]: Sent alert events, first sequence_id %"PRIu64", last sequence_id %"PRIu64, wc->node_id, wc->host->hostname, log_first_sequence_id, log_last_sequence_id);
278
log_first_sequence_id = 0;
279
log_last_sequence_id = 0;
280
}