ovsdb: register a shutdown objects for in-flight calls

Once the shutdown logic is in place, we don't want to shut down until
the OVSDB calls are serviced.
This commit is contained in:
Lubomir Rintel 2022-02-22 15:14:09 +01:00
parent 47ff99515f
commit be414f1ce7

View file

@ -104,6 +104,7 @@ typedef struct {
OvsdbMethodCallback callback;
gpointer user_data;
OvsdbMethodPayload payload;
GObject *shutdown_wait_obj;
} OvsdbMethodCall;
/*****************************************************************************/
@ -245,6 +246,8 @@ static NM_UTILS_LOOKUP_STR_DEFINE(_device_type_to_table,
static void
_call_complete(OvsdbMethodCall *call, json_t *response, GError *error)
{
g_clear_object(&call->shutdown_wait_obj);
if (response) {
gs_free char *str = NULL;
@ -378,12 +381,14 @@ ovsdb_call_method(NMOvsdb *self,
call = g_slice_new(OvsdbMethodCall);
*call = (OvsdbMethodCall){
.self = self,
.call_id = CALL_ID_UNSPEC,
.command = command,
.callback = callback,
.user_data = user_data,
.self = self,
.call_id = CALL_ID_UNSPEC,
.command = command,
.callback = callback,
.user_data = user_data,
.shutdown_wait_obj = g_object_new(G_TYPE_OBJECT, NULL),
};
nm_shutdown_wait_obj_register_object(call->shutdown_wait_obj, "ovsdb-call");
if (add_first)
c_list_link_front(&priv->calls_lst_head, &call->calls_lst);