1
0

Try to fix upload manager

This commit is contained in:
Scott E. Graves
2017-03-30 19:22:39 -05:00
parent 4f226eadbb
commit 58dc95c349

View File

@@ -310,15 +310,21 @@ void CUploadManager::AutoThreadCallback(const CSiaCurl& siaCurl, CSiaDriveConfig
SString siaPath = static_cast<const char*>(query.getColumn(query.getColumnIndex("sia_path")));
SString filePath = static_cast<const char*>(query.getColumn(query.getColumnIndex("file_path")));
SString sdFilePath = static_cast<const char*>(query.getColumn(query.getColumnIndex("sd_file_path")));
// TODO Rethink this - could hang here for quite a while creating temporary files
if (CreateSiaDriveFile(siaPath, filePath, sdFilePath + ".temp", sdFilePath))
if (dokanDrive->LockFile(filePath))
{
// TODO Validate response
json response;
SiaCurlError cerror = siaCurl.Post(SString(L"/renter/upload/") + siaPath, { {L"source", filePath} }, response);
if (ApiSuccess(cerror))
if (CreateSiaDriveFile(siaPath, filePath, sdFilePath + ".temp", sdFilePath))
{
SET_STATUS(UploadStatus::Uploading, UploadToSiaStarted, ModifyUploadStatusFailed)
dokanDrive->UnLockFile(filePath, sdFilePath);
json response;
SiaCurlError cerror = siaCurl.Post(SString(L"/renter/upload/") + siaPath, { {L"source", filePath} }, response);
if (ApiSuccess(cerror))
{
SET_STATUS(UploadStatus::Uploading, UploadToSiaStarted, ModifyUploadStatusFailed)
}
}
else
{
dokanDrive->UnLockFile(filePath);
}
}
}