diff options
| author | Michael Biebl <biebl@debian.org> | 2018-03-13 01:29:54 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2018-03-13 01:29:54 +0100 |
| commit | 7e9ff09fcb2366b383b7ebbec80d2f6fff117290 (patch) | |
| tree | e48e88b177182607488bcfd2d2645dbc77276866 /src/devices/ovs/nm-ovsdb.c | |
| parent | 50f6b47074e01dffb8dc536c0a20961dcf28ae9b (diff) | |
New upstream version 1.10.6 upstream/1.10.6
Diffstat (limited to 'src/devices/ovs/nm-ovsdb.c')
| -rw-r--r-- | src/devices/ovs/nm-ovsdb.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/src/devices/ovs/nm-ovsdb.c b/src/devices/ovs/nm-ovsdb.c index b44668c0..92fcfa01 100644 --- a/src/devices/ovs/nm-ovsdb.c +++ b/src/devices/ovs/nm-ovsdb.c @@ -119,7 +119,7 @@ NM_DEFINE_SINGLETON_GETTER (NMOvsdb, nm_ovsdb_get, NM_TYPE_OVSDB); /*****************************************************************************/ static void ovsdb_try_connect (NMOvsdb *self); -static void ovsdb_disconnect (NMOvsdb *self); +static void ovsdb_disconnect (NMOvsdb *self, gboolean is_disposing); static void ovsdb_read (NMOvsdb *self); static void ovsdb_write (NMOvsdb *self); static void ovsdb_next_command (NMOvsdb *self); @@ -1103,7 +1103,7 @@ ovsdb_got_msg (NMOvsdb *self, json_t *msg) "result", &result, "error", &error) == -1) { _LOGW ("couldn't grok the message: %s", json_error.text); - ovsdb_disconnect (self); + ovsdb_disconnect (self, FALSE); return; } @@ -1114,7 +1114,7 @@ ovsdb_got_msg (NMOvsdb *self, json_t *msg) /* It's a method call! */ if (!params) { _LOGW ("a method call with no params: '%s'", method); - ovsdb_disconnect (self); + ovsdb_disconnect (self, FALSE); return; } @@ -1134,13 +1134,13 @@ ovsdb_got_msg (NMOvsdb *self, json_t *msg) /* This is a response to a method call. */ if (!priv->calls->len) { _LOGE ("there are no queued calls expecting response %" G_GUINT64_FORMAT, id); - ovsdb_disconnect (self); + ovsdb_disconnect (self, FALSE); return; } call = &g_array_index (priv->calls, OvsdbMethodCall, 0); if (call->id != id) { _LOGE ("expected a response to call %" G_GUINT64_FORMAT ", not %" G_GUINT64_FORMAT, call->id, id); - ovsdb_disconnect (self); + ovsdb_disconnect (self, FALSE); return; } /* Cool, we found a corresponsing call. Finish it. */ @@ -1219,7 +1219,7 @@ ovsdb_read_cb (GObject *source_object, GAsyncResult *res, gpointer user_data) if (size == -1) { _LOGW ("short read from ovsdb: %s", error->message); g_clear_error (&error); - ovsdb_disconnect (self); + ovsdb_disconnect (self, FALSE); return; } @@ -1267,7 +1267,7 @@ ovsdb_write_cb (GObject *source_object, GAsyncResult *res, gpointer user_data) if (size == -1) { _LOGW ("short write to ovsdb: %s", error->message); g_clear_error (&error); - ovsdb_disconnect (self); + ovsdb_disconnect (self, FALSE); return; } @@ -1310,21 +1310,19 @@ ovsdb_write (NMOvsdb *self) * puts us back in sync. */ static void -ovsdb_disconnect (NMOvsdb *self) +ovsdb_disconnect (NMOvsdb *self, gboolean is_disposing) { NMOvsdbPrivate *priv = NM_OVSDB_GET_PRIVATE (self); OvsdbMethodCall *call; OvsdbMethodCallback callback; gpointer user_data; - GError *error; + gs_free_error GError *error = NULL; _LOGD ("disconnecting from ovsdb"); + nm_utils_error_set_cancelled (&error, is_disposing, "NMOvsdb"); while (priv->calls->len) { - error = NULL; call = &g_array_index (priv->calls, OvsdbMethodCall, priv->calls->len - 1); - g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_CANCELLED, "Cancelled"); - callback = call->callback; user_data = call->user_data; g_array_remove_index (priv->calls, priv->calls->len - 1); @@ -1343,12 +1341,10 @@ static void _monitor_bridges_cb (NMOvsdb *self, json_t *result, GError *error, gpointer user_data) { if (error) { - if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + if (!nm_utils_error_is_cancelled (error, TRUE)) { _LOGI ("%s", error->message); - ovsdb_disconnect (self); + ovsdb_disconnect (self, FALSE); } - - g_clear_error (&error); return; } @@ -1371,7 +1367,7 @@ _client_connect_cb (GObject *source_object, GAsyncResult *res, gpointer user_dat if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) _LOGI ("%s", error->message); - ovsdb_disconnect (self); + ovsdb_disconnect (self, FALSE); g_clear_error (&error); return; } @@ -1555,7 +1551,7 @@ dispose (GObject *object) NMOvsdb *self = NM_OVSDB (object); NMOvsdbPrivate *priv = NM_OVSDB_GET_PRIVATE (self); - ovsdb_disconnect (self); + ovsdb_disconnect (self, TRUE); g_string_free (priv->input, TRUE); priv->input = NULL; |