summaryrefslogtreecommitdiffstats
path: root/net/colo-compare.c
diff options
context:
space:
mode:
authorZhang Chen2020-10-16 07:52:07 +0200
committerJason Wang2020-11-11 09:52:23 +0100
commit17475df2c1f5dc5b9a4fecd5997765897782832e (patch)
treeaf78e7242425256251c3aab37c79d6f5e9388a33 /net/colo-compare.c
parentnet/colo-compare.c: Change the timer clock type (diff)
downloadqemu-17475df2c1f5dc5b9a4fecd5997765897782832e.tar.gz
qemu-17475df2c1f5dc5b9a4fecd5997765897782832e.tar.xz
qemu-17475df2c1f5dc5b9a4fecd5997765897782832e.zip
net/colo-compare.c: Add secondary old packet detection
Detect queued secondary packet to sync VM state in time. Signed-off-by: Zhang Chen <chen.zhang@intel.com> Reviewed-by: Li Zhijian <lizhijian@cn.fujitsu.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'net/colo-compare.c')
-rw-r--r--net/colo-compare.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/net/colo-compare.c b/net/colo-compare.c
index 1263203e7f..0c87fd9e33 100644
--- a/net/colo-compare.c
+++ b/net/colo-compare.c
@@ -636,19 +636,26 @@ void colo_compare_unregister_notifier(Notifier *notify)
static int colo_old_packet_check_one_conn(Connection *conn,
CompareState *s)
{
- GList *result = NULL;
-
- result = g_queue_find_custom(&conn->primary_list,
- &s->compare_timeout,
- (GCompareFunc)colo_old_packet_check_one);
+ if (!g_queue_is_empty(&conn->primary_list)) {
+ if (g_queue_find_custom(&conn->primary_list,
+ &s->compare_timeout,
+ (GCompareFunc)colo_old_packet_check_one))
+ goto out;
+ }
- if (result) {
- /* Do checkpoint will flush old packet */
- colo_compare_inconsistency_notify(s);
- return 0;
+ if (!g_queue_is_empty(&conn->secondary_list)) {
+ if (g_queue_find_custom(&conn->secondary_list,
+ &s->compare_timeout,
+ (GCompareFunc)colo_old_packet_check_one))
+ goto out;
}
return 1;
+
+out:
+ /* Do checkpoint will flush old packet */
+ colo_compare_inconsistency_notify(s);
+ return 0;
}
/*