Feature: query the remote SHA-256 before previewing
When the main connection advertises CLIENT_CAP_FILE_HASH, double-click sends COMMAND_FILE_HASH first and continues from the async TOKEN_FILE_HASH response (posted to the UI thread). A matching SHA-256 opens the cached copy without a transfer, including content found under a different remote path; the new path is added to the index. Too-large and error responses are handled, and a 5 second timeout falls back to the P1 size/mtime path. The response parser is based on FileHashResponseHeader and the echoed request path; pending state is cleared on close and the hash timer is killed with the dialog. Verified with the Debug server and client: a 1 MiB file was hashed, transferred and cached under its SHA-256; an identical copy at a second path hit the cache with no new transfer or stream connection. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
ea5d69d1c0
commit
6cb779ef70
7 files changed
+168
-5
No files matched your search
@@ -129,12 +129,23 @@ public:
|
||||
bool m_bRemoteSearchResults = false;
|
||||
struct RemoteMeta { uint64_t size = 0; uint64_t mtimeMs = 0; };
|
||||
std::map<std::string, RemoteMeta> m_RemoteMeta; // key = 完整远程路径(GBK)
|
||||
struct PendingHashPreview {
|
||||
CString fullPath; // 空 = 没有待响应的哈希请求
|
||||
uint64_t clientID = 0;
|
||||
uint64_t size = 0;
|
||||
uint64_t mtimeMs = 0;
|
||||
};
|
||||
PendingHashPreview m_pendingHash;
|
||||
enum { kPreviewHashTimer = 0x51 };
|
||||
afx_msg LRESULT OnPreviewResult(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg LRESULT OnPreviewHashResult(WPARAM wParam, LPARAM lParam);
|
||||
#ifdef _DEBUG
|
||||
// E2E 测试钩子:WM_APP+0x123,wParam=行号,lParam!=0 表示远程列表。
|
||||
afx_msg LRESULT OnPreviewTest(WPARAM wParam, LPARAM lParam);
|
||||
#endif
|
||||
void BeginRemotePreview(const CString& fullPath);
|
||||
void ContinueRemotePreview(const CString& fullPath, uint64_t size, uint64_t mtimeMs,
|
||||
const std::string& sha256);
|
||||
void OpenLocalPath(const CString& path);
|
||||
bool GetRemoteFileMeta(const CString& fullPath, RemoteMeta& meta);
|
||||
std::string GetPreviewClientKey(uint64_t clientID);
|
||||
|
||||
Reference in new issue
Block a user