Qdevice may crash if server disconnect before connect
heuristics callback is processed.
This is quite hard to reproduce without adding sleep before
qdevice_net_heuristics_exec_after_connect call.
Solution is to check if qdevice is still connected and if it doesn't,
just throw away connect heuristics results.
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
instance = heuristics_instance->qdevice_instance_ptr;
net_instance = instance->model_data;
-
if (qdevice_heuristics_result_notifier_list_set_active(&heuristics_instance->exec_result_notifier_list,
qdevice_net_connect_heuristics_exec_result_callback, 0) != 0) {
log(LOG_ERR, "Can't deactivate net connect heuristics exec callback notifier");
return (0);
}
+ if (net_instance->state != QDEVICE_NET_INSTANCE_STATE_WAITING_VOTEQUORUM_CMAP_EVENTS) {
+ /*
+ * Not connected to qnetd -> heuristics will be called again on new connect
+ */
+ return (0);
+ }
+
heuristics = qdevice_net_heuristics_exec_result_to_tlv(exec_result);
send_config_node_list = 1;