summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2022-02-22 15:14:09 +0100
committerLubomir Rintel <lkundrak@v3.sk>2022-02-22 16:33:29 +0100
commitbe414f1ce728dfbd4e57f369a4bfc3a1a5c9b25a (patch)
tree339893c8b33a8d81c2a0e8692cadbb52a9b1b503
parent47ff99515f0ecbc791851f3c1a1c61fb7efc234c (diff)
ovsdb: register a shutdown objects for in-flight callslr/ovsdb-shutdown
Once the shutdown logic is in place, we don't want to shut down until the OVSDB calls are serviced.
-rw-r--r--src/core/devices/ovs/nm-ovsdb.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/core/devices/ovs/nm-ovsdb.c b/src/core/devices/ovs/nm-ovsdb.c
index 7c45e0e48b..3c91323d78 100644
--- a/src/core/devices/ovs/nm-ovsdb.c
+++ b/src/core/devices/ovs/nm-ovsdb.c
@@ -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);