From 365f72fd51e24f635ee5f2d4ba570d368bb4855c Mon Sep 17 00:00:00 2001 From: reito Date: Sun, 2 Jun 2024 14:38:37 +0800 Subject: [PATCH] fix heartbeat --- ui/windows/collabroom.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ui/windows/collabroom.cpp b/ui/windows/collabroom.cpp index 8c0e64c..1d317a7 100644 --- a/ui/windows/collabroom.cpp +++ b/ui/windows/collabroom.cpp @@ -174,17 +174,6 @@ CollabRoom::CollabRoom(bool isServer, QString roomId, QWidget *parent) : qDebug() << "set spout" << s; }); - // If server, start sending heartbeat, and rtt update - if (isServer) { - heartbeat = std::unique_ptr(QThread::create([this]() { - while (!exiting) { - QThread::sleep(10); - heartbeatUpdate(); - } - })); - heartbeat->start(); - } - usageStat = std::make_unique(this); connect(usageStat.get(), &QTimer::timeout, this, [this]() { usageStatUpdate(); @@ -408,6 +397,17 @@ void CollabRoom::roomInfoSucceed(const vts::server::RspRoomInfo &info) { serverPeer->startClient(); } + // If server, start sending heartbeat, and rtt update + if (isServer) { + heartbeat = std::unique_ptr(QThread::create([this]() { + while (!exiting) { + QThread::sleep(10); + heartbeatUpdate(); + } + })); + heartbeat->start(); + } + show(); activateWindow(); }