Try to fix upload manager
This commit is contained in:
@@ -310,15 +310,21 @@ void CUploadManager::AutoThreadCallback(const CSiaCurl& siaCurl, CSiaDriveConfig
|
|||||||
SString siaPath = static_cast<const char*>(query.getColumn(query.getColumnIndex("sia_path")));
|
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 filePath = static_cast<const char*>(query.getColumn(query.getColumnIndex("file_path")));
|
||||||
SString sdFilePath = static_cast<const char*>(query.getColumn(query.getColumnIndex("sd_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 (dokanDrive->LockFile(filePath))
|
||||||
if (CreateSiaDriveFile(siaPath, filePath, sdFilePath + ".temp", sdFilePath))
|
|
||||||
{
|
{
|
||||||
// TODO Validate response
|
if (CreateSiaDriveFile(siaPath, filePath, sdFilePath + ".temp", 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)
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user