Feature: double-click file preview in the classic file manager #10

Merged
yuanyuanxiang merged 10 commits from feature/file-preview into main 2026-12-05 15:59:14 +00:00
2 changed files with 21 additions and 13 deletions
Showing only changes of commit ea5d69d1c0 - Show all commits

No files matched your search

+2
View File
@@ -278,6 +278,8 @@ bool CFilePreviewMgr::ObserveChunk(CONTEXT_OBJECT* ctx, const FileChunkPacketV2*
std::string safeName(name, nameLen);
std::lock_guard<std::mutex> lk(m_mtx);
if (m_reqs.empty() && m_tombstones.empty())
return true; // 普通 V2 传输的热路径:没有预览会话时不做任何扫描
Request* req = FindByTransferLocked(ctx, pkt->transferID);
if (req) {
+19 -13
View File
@@ -14607,12 +14607,14 @@ bool CMcpServer::BeginFileTransferPending(uint64_t device_id, const std::string&
if (!DeviceTransferGate::Instance().TryClaim(device_id, owner)) return false;
// 与一次性挂起请求互斥(F2):先查对方注册表再查自己的,避免跨锁嵌套死锁。
bool pendingBusy = false;
{
std::lock_guard<std::mutex> lk(m_PendingMutex);
if (m_Pending.find(device_id) != m_Pending.end()) {
DeviceTransferGate::Instance().Release(device_id, owner);
return false;
}
pendingBusy = m_Pending.find(device_id) != m_Pending.end();
}
if (pendingBusy) {
DeviceTransferGate::Instance().Release(device_id, owner);
return false;
}
bool registered = false;
{
@@ -14644,12 +14646,14 @@ bool CMcpServer::BeginFileUpload(uint64_t device_id, uint64_t transfer_id) {
if (!DeviceTransferGate::Instance().TryClaim(device_id, owner)) return false;
// 与一次性挂起请求互斥(F2):先查对方注册表再查自己的,避免跨锁嵌套死锁。
bool pendingBusy = false;
{
std::lock_guard<std::mutex> lk(m_PendingMutex);
if (m_Pending.find(device_id) != m_Pending.end()) {
DeviceTransferGate::Instance().Release(device_id, owner);
return false;
}
pendingBusy = m_Pending.find(device_id) != m_Pending.end();
}
if (pendingBusy) {
DeviceTransferGate::Instance().Release(device_id, owner);
return false;
}
bool registered = false;
{
@@ -14685,14 +14689,16 @@ bool CMcpServer::BeginC2CTransfer(uint64_t src_id, uint64_t dst_id, uint64_t tra
const uint64_t owner = s_ownerSeq.fetch_add(1);
if (!DeviceTransferGate::Instance().TryClaimPair(src_id, dst_id, owner)) return false;
bool pendingBusy = false;
{
// 与一次性挂起请求互斥(F2):先查对方注册表再查自己的,避免跨锁嵌套死锁。
std::lock_guard<std::mutex> lk(m_PendingMutex);
if (m_Pending.find(src_id) != m_Pending.end() ||
m_Pending.find(dst_id) != m_Pending.end()) {
DeviceTransferGate::Instance().ReleasePair(src_id, dst_id, owner);
return false;
}
pendingBusy = (m_Pending.find(src_id) != m_Pending.end() ||
m_Pending.find(dst_id) != m_Pending.end());
}
if (pendingBusy) {
DeviceTransferGate::Instance().ReleasePair(src_id, dst_id, owner);
return false;
}
bool registered = false;
{