Fix: keep the device gate outside the MCP pending lock

Release the DeviceTransferGate only after leaving m_PendingMutex in the
three MCP begin paths, matching the documented gate -> pending -> xfer
order (the gate mutex is brief, but this keeps the order explicit and
avoids future nesting mistakes).

Also short-circuit ObserveChunk when there are no preview requests or
tombstones, so ordinary V2 chunk paths do not scan the preview maps.

Co-Authored-By: deepseek-flash
This commit is contained in:
yuanyuanxianganddeepseek-flash committed 2026-12-05 15:33:57 +01:00
1 parent 3683b4ebeb
commit ea5d69d1c0
2 files changed
+21 -13

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) {