Skip to content

Commit 951f904

Browse files
committed
fix heartbeat
1 parent 365f72f commit 951f904

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

core/room_server.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ void RoomServer::startReceiveNotify() {
7575
qDebug() << "notify thread exited";
7676
}));
7777
notifyThread->start();
78+
startNatTypeDetect();
7879
}
7980

8081
void RoomServer::startNatTypeDetect() {
@@ -121,9 +122,9 @@ void RoomServer::createRoom(const vts::server::ReqCreateRoom& req) {
121122
}
122123

123124
this->roomId = rsp.roomid();
124-
startReceiveNotify();
125-
startNatTypeDetect();
126125
emit room->onRoomInfoSucceed(rsp);
126+
127+
startReceiveNotify();
127128
});
128129
CollabRoom::connect(worker, &QThread::finished, worker, &QThread::deleteLater);
129130
worker->setParent(room);
@@ -153,7 +154,6 @@ void RoomServer::joinRoom(const std::string& peerId, const std::string& roomId,
153154
}
154155

155156
startReceiveNotify();
156-
startNatTypeDetect();
157157
emit room->onRoomInfoSucceed(rsp);
158158
});
159159
CollabRoom::connect(worker, &QThread::finished, worker, &QThread::deleteLater);

ui/windows/collabroom.cpp

+10-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,14 @@ CollabRoom::CollabRoom(bool isServer, QString roomId, QWidget *parent) :
107107
qDebug() << "Using Room Endpoint" << roomEndpoint;
108108

109109
this->roomId = roomId;
110-
localPeerId = QUuid::createUuid().toString(QUuid::WithoutBraces);
110+
111+
localPeerId = QSysInfo::machineUniqueId();
112+
if (localPeerId.isEmpty()) {
113+
localPeerId = QSysInfo::bootUniqueId();
114+
}
115+
if (localPeerId.isEmpty()) {
116+
localPeerId = QUuid::createUuid().toString(QUuid::WithoutBraces);
117+
}
111118

112119
useDxCapture = settings.value("useDxCapture", false).toBool();
113120
qDebug() << "sender is" << (useDxCapture ? "dx" : "spout");
@@ -410,6 +417,8 @@ void CollabRoom::roomInfoSucceed(const vts::server::RspRoomInfo &info) {
410417

411418
show();
412419
activateWindow();
420+
421+
isRoomInfoReady = true;
413422
}
414423

415424
void CollabRoom::roomInfoFailed(const string &error) {

ui/windows/collabroom.h

+2
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ private slots:
138138

139139
bool isServer;
140140
bool useDxCapture;
141+
bool isRoomInfoReady;
142+
141143
QString roomId;
142144
QString localPeerId;
143145

0 commit comments

Comments
 (0)