summary refs log tree commit diff
path: root/src/platform/nmp-object.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2016-08-26 02:18:32 +0200
committerMichael Biebl <biebl@debian.org>2016-08-26 02:18:32 +0200
commit7514efc2f38c9ace4557d4e69d68e7d380389030 (patch)
tree7fb00fda86cfcc2ca377f191633a7cfdbfea7ca3 /src/platform/nmp-object.c
parentd6201f5d8daada3d64a0a3e0038e14eebec683ce (diff)
Imported Upstream version 1.4.0 upstream/1.4.0
Diffstat (limited to 'src/platform/nmp-object.c')
-rw-r--r--src/platform/nmp-object.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/platform/nmp-object.c b/src/platform/nmp-object.c
index eb7e1ca4..30a52c25 100644
--- a/src/platform/nmp-object.c
+++ b/src/platform/nmp-object.c
@@ -47,6 +47,10 @@
         } \
     } G_STMT_END
 
+/* logging to trace object lifetime and references.
+ * Disabled by default. */
+#define _LOGr(...) G_STMT_START { if (FALSE) { _LOGt (__VA_ARGS__); } } G_STMT_END
+
 /*********************************************************************************************/
 
 struct _NMPCache {
@@ -211,7 +215,7 @@ nmp_object_ref (NMPObject *obj)
 	g_return_val_if_fail (obj->_ref_count != NMP_REF_COUNT_STACKINIT, NULL);
 	obj->_ref_count++;
 
-	_LOGt (obj, "ref: %d", obj->_ref_count);
+	_LOGr (obj, "ref: %d", obj->_ref_count);
 
 	return obj;
 }
@@ -222,7 +226,7 @@ nmp_object_unref (NMPObject *obj)
 	if (obj) {
 		g_return_if_fail (obj->_ref_count > 0);
 		g_return_if_fail (obj->_ref_count != NMP_REF_COUNT_STACKINIT);
-		_LOGt (obj, "%s: %d",
+		_LOGr (obj, "%s: %d",
 		       obj->_ref_count <= 1 ? "destroy" : "unref",
 		       obj->_ref_count - 1);
 		if (--obj->_ref_count <= 0) {
@@ -262,7 +266,7 @@ _nmp_object_new_from_class (const NMPClass *klass)
 	obj = g_slice_alloc0 (klass->sizeof_data + G_STRUCT_OFFSET (NMPObject, object));
 	obj->_class = klass;
 	obj->_ref_count = 1;
-	_LOGt (obj, "new");
+	_LOGr (obj, "new");
 	return obj;
 }
 
@@ -915,12 +919,12 @@ _vt_cmd_obj_is_alive_ipx_route (const NMPObject *obj)
 	 *
 	 * If nmp_object_from_nl() would just return NULL, we couldn't look
 	 * into the cache to see if it contains a route that now disappears
-	 * (because it is cloned).
+	 * (because it changed to be cloned).
 	 *
 	 * Instead we create a dead object, and nmp_cache_update_netlink()
 	 * will remove the old version of the update.
 	 **/
-	return obj->object.ifindex > 0 && (obj->ip_route.source != _NM_IP_CONFIG_SOURCE_RTM_F_CLONED);
+	return obj->object.ifindex > 0 && !obj->ip_route.rt_cloned;
 }
 
 gboolean