Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"native-src/sync_root_interface/callbacks/CancelFetchData/CancelFetchDataCallback.cpp",
"native-src/sync_root_interface/callbacks/FetchData/FetchData.cpp",
"native-src/sync_root_interface/callbacks/FetchData/FileCopierWithProgress.cpp",
"native-src/sync_root_interface/callbacks/FetchData/TransferContext.cpp",
"native-src/sync_root_interface/callbacks/FetchPlaceholder/FetchPlaceholder.cpp",
"native-src/sync_root_interface/callbacks/NotifyDelete/NotifyDeleteCallback.cpp",
"native-src/sync_root_interface/callbacks/NotifyFileAdded/NotifyFileAddedCallback.cpp",
Expand Down
38 changes: 38 additions & 0 deletions include/sync_root_interface/TransferContext.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#pragma once
#include <map>
#include <memory>
#include <mutex>
#include <condition_variable>
#include <string>
#include "stdafx.h"
#include <cfapi.h>
#include "Logger.h"
#include "Utilities.h"
#include "Placeholders.h"
#include "FileCopierWithProgress.h"

struct TransferContext {
CF_CONNECTION_KEY connectionKey;
CF_TRANSFER_KEY transferKey;
LARGE_INTEGER fileSize;
LARGE_INTEGER requiredLength;
LARGE_INTEGER requiredOffset;
CF_CALLBACK_INFO callbackInfo;
std::wstring fullClientPath;

size_t lastReadOffset = 0;
size_t lastSize = 0;
bool loadFinished = false;

std::mutex mtx;
std::condition_variable cv;
bool ready = false;

std::wstring fullServerFilePath;
};

std::shared_ptr<TransferContext> GetOrCreateTransferContext(
CF_CONNECTION_KEY connKey,
CF_TRANSFER_KEY transferKey);

void RemoveTransferContext(CF_TRANSFER_KEY transferKey);
Loading