fix:接收端未检测到发送端断连的情况处理。处理传输退出功能。
This commit is contained in:
@@ -212,6 +212,7 @@ void ClientCore::UseFrame(QSharedPointer<FrameBuffer> frame)
|
||||
break;
|
||||
}
|
||||
case FBT_SER_MSG_OFFLINE: {
|
||||
popID(frame->fid);
|
||||
emit sigOffline(frame);
|
||||
break;
|
||||
}
|
||||
@@ -227,6 +228,10 @@ void ClientCore::UseFrame(QSharedPointer<FrameBuffer> frame)
|
||||
emit sigFlowBack(frame);
|
||||
break;
|
||||
}
|
||||
case FBT_CLI_TRANS_INTERRUPT: {
|
||||
emit sigTransInterrupt(frame);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
qCritical() << QString("未知的帧类型: %1").arg(frame->type);
|
||||
break;
|
||||
@@ -285,6 +290,20 @@ QString ClientCore::GetOwnID()
|
||||
return ownID_;
|
||||
}
|
||||
|
||||
void ClientCore::pushID(const QString& id)
|
||||
{
|
||||
QWriteLocker locker(&rwIDLock_);
|
||||
if (!remoteIDs_.contains(id)) {
|
||||
remoteIDs_.push_back(id);
|
||||
}
|
||||
}
|
||||
|
||||
void ClientCore::popID(const QString& id)
|
||||
{
|
||||
QWriteLocker locker(&rwIDLock_);
|
||||
remoteIDs_.removeAll(id);
|
||||
}
|
||||
|
||||
SocketWorker::SocketWorker(ClientCore* core, QObject* parent) : QThread(parent), core_(core)
|
||||
{
|
||||
// connect(core_, &ClientCore::sigDisconnect, this, [this]() {
|
||||
@@ -328,10 +347,17 @@ void HeatBeat::run()
|
||||
}
|
||||
ClientCore::syncInvoke(core_, frame);
|
||||
auto rid = core_->GetRemoteID();
|
||||
if (rid.isEmpty()) {
|
||||
continue;
|
||||
if (!rid.isEmpty()) {
|
||||
auto frame2 = core_->GetBuffer(info, FBT_SER_MSG_JUDGE_OTHER_ALIVE, rid);
|
||||
ClientCore::syncInvoke(core_, frame2);
|
||||
}
|
||||
|
||||
{
|
||||
QReadLocker loker(&core_->rwIDLock_);
|
||||
for (auto& id : core_->remoteIDs_) {
|
||||
auto frame3 = core_->GetBuffer(info, FBT_SER_MSG_JUDGE_OTHER_ALIVE, id);
|
||||
ClientCore::syncInvoke(core_, frame3);
|
||||
}
|
||||
}
|
||||
auto frame2 = core_->GetBuffer(info, FBT_SER_MSG_JUDGE_OTHER_ALIVE, rid);
|
||||
ClientCore::syncInvoke(core_, frame2);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user