Skip to content

Commit 4e2bb09

Browse files
committed
fix request after dead
1 parent 2d2b102 commit 4e2bb09

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

core/room_server.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ void RoomServer::setSdp(const vts::server::Sdp &sdp) {
168168
if (!status.ok()) {
169169
qDebug() << __FUNCTION__ << "failed:" << status.error_message().c_str();
170170
emit room->onRoomServerError(__FUNCTION__, status.error_message().c_str());
171+
requestHasFailed = true;
171172
}
172173
}
173174

@@ -181,6 +182,7 @@ void RoomServer::setCandidate(const vts::server::Candidate& candidate) {
181182
if (!status.ok()) {
182183
qDebug() << __FUNCTION__ << "failed:" << status.error_message().c_str();
183184
emit room->onRoomServerError(__FUNCTION__, status.error_message().c_str());
185+
requestHasFailed = true;
184186
}
185187
}
186188

@@ -197,6 +199,7 @@ void RoomServer::setNat(int type) {
197199
if (!status.ok()) {
198200
qDebug() << __FUNCTION__ << "failed:" << status.error_message().c_str();
199201
emit room->onRoomServerError(__FUNCTION__, status.error_message().c_str());
202+
requestHasFailed = true;
200203
}
201204
}
202205

@@ -210,6 +213,7 @@ void RoomServer::setRtt(const vts::server::ReqRtt &rtt) {
210213
if (!status.ok()) {
211214
qDebug() << __FUNCTION__ << "failed:" << status.error_message().c_str();
212215
emit room->onRoomServerError(__FUNCTION__, status.error_message().c_str());
216+
requestHasFailed = true;
213217
}
214218
}
215219

@@ -223,6 +227,7 @@ void RoomServer::setStat(const vts::server::ReqStat &stat) {
223227
if (!status.ok()) {
224228
qDebug() << __FUNCTION__ << "failed:" << status.error_message().c_str();
225229
emit room->onRoomServerError(__FUNCTION__, status.error_message().c_str());
230+
requestHasFailed = true;
226231
}
227232
}
228233

@@ -239,6 +244,7 @@ void RoomServer::setNick(const string &nick) {
239244
if (!status.ok()) {
240245
qDebug() << __FUNCTION__ << "failed:" << status.error_message().c_str();
241246
emit room->onRoomServerError(__FUNCTION__, status.error_message().c_str());
247+
requestHasFailed = true;
242248
}
243249
}
244250

@@ -255,6 +261,7 @@ void RoomServer::setTurn(const string &turn) {
255261
if (!status.ok()) {
256262
qDebug() << __FUNCTION__ << "failed:" << status.error_message().c_str();
257263
emit room->onRoomServerError(__FUNCTION__, status.error_message().c_str());
264+
requestHasFailed = true;
258265
}
259266
}
260267

@@ -268,6 +275,7 @@ void RoomServer::setFrameFormat(const vts::server::FrameFormatSetting &format) {
268275
if (!status.ok()) {
269276
qDebug() << __FUNCTION__ << "failed:" << status.error_message().c_str();
270277
emit room->onRoomServerError(__FUNCTION__, status.error_message().c_str());
278+
requestHasFailed = true;
271279
}
272280
}
273281

@@ -288,6 +296,7 @@ void RoomServer::setShareInfo(const std::string& gpu, const std::string& capture
288296
if (!status.ok()) {
289297
qDebug() << __FUNCTION__ << "failed:" << status.error_message().c_str();
290298
emit room->onRoomServerError(__FUNCTION__, status.error_message().c_str());
299+
requestHasFailed = true;
291300
}
292301
}
293302

@@ -325,5 +334,6 @@ void RoomServer::requestIdr(const std::string& reason, const std::string& peer)
325334
if (!status.ok()) {
326335
qDebug() << __FUNCTION__ << "failed:" << status.error_message().c_str();
327336
emit room->onRoomServerError(__FUNCTION__, status.error_message().c_str());
337+
requestHasFailed = true;
328338
}
329339
}

core/room_server.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ class RoomServer {
1818
std::atomic_bool exiting = false;
1919
std::atomic_bool destroyed = false;
2020

21+
std::atomic_bool requestHasFailed = false;
22+
2123
std::unique_ptr<QThread> natThread;
2224
std::unique_ptr<QThread> notifyThread;
2325
std::unique_ptr<grpc::ClientContext> notifyContext;
@@ -39,7 +41,7 @@ class RoomServer {
3941
void joinRoom(const std::string& peerId, const std::string& roomId, const std::string& nick);
4042

4143
inline std::unique_ptr<grpc::ClientContext> getCtx() {
42-
if (peerId.empty() || roomId.empty())
44+
if (peerId.empty() || roomId.empty() || requestHasFailed)
4345
return nullptr;
4446

4547
auto ctx = std::make_unique<grpc::ClientContext>();

ui/windows/collabroom.cpp

+1-7
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,7 @@ CollabRoom::CollabRoom(bool isServer, QString roomId, QWidget *parent) :
108108

109109
this->roomId = roomId;
110110

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-
}
111+
localPeerId = QUuid::createUuid().toString(QUuid::WithoutBraces);
118112

119113
useDxCapture = settings.value("useDxCapture", false).toBool();
120114
qDebug() << "sender is" << (useDxCapture ? "dx" : "spout");

0 commit comments

Comments
 (0)