mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-08 04:31:08 -06:00
warnings if download to memory failed for some reason
This commit is contained in:
@@ -184,7 +184,9 @@ bool DataPlane::loadTexture() {
|
||||
}
|
||||
|
||||
bool DataPlane::updateTexture(){
|
||||
if(_futureObject)
|
||||
|
||||
// If a download is in progress, dont send another request.
|
||||
if(_futureObject && !_futureObject->isFinished && !_futureObject->isAborted)
|
||||
return false;
|
||||
|
||||
_memorybuffer = "";
|
||||
|
||||
@@ -136,8 +136,7 @@ bool ScreenSpaceCygnet::isReady() const{
|
||||
|
||||
void ScreenSpaceCygnet::updateTexture(){
|
||||
// If a download is in progress, dont send another request.
|
||||
//What if image failed to download?
|
||||
if(_futureTexture && !_futureTexture->isFinished)
|
||||
if(_futureTexture && !_futureTexture->isFinished && !_futureTexture->isAborted)
|
||||
return;
|
||||
|
||||
_memorybuffer = "";
|
||||
|
||||
@@ -111,7 +111,9 @@ bool TexturePlane::loadTexture() {
|
||||
|
||||
|
||||
bool TexturePlane::updateTexture(){
|
||||
if(_futureObject)
|
||||
|
||||
// If a download is in progress, dont send another request.
|
||||
if(_futureObject && !_futureObject->isFinished && !_futureObject->isAborted)
|
||||
return false;
|
||||
|
||||
_memorybuffer = "";
|
||||
|
||||
@@ -125,10 +125,14 @@ void ISWAManager::addISWACygnet(int id, std::string info, int group){
|
||||
|
||||
auto metadataCallback =
|
||||
[this, metaFuture](const DownloadManager::FileFuture& f){
|
||||
LDEBUG("Download to memory finished");
|
||||
metaFuture->isFinished = true;
|
||||
createPlane(metaFuture);
|
||||
};
|
||||
if(f.isFinished){
|
||||
metaFuture->isFinished;
|
||||
createPlane(metaFuture);
|
||||
LDEBUG("Download to memory finished");
|
||||
} else if (f.isAborted){
|
||||
LWARNING("Download to memory was aborted: " + f.errorMessage);
|
||||
}
|
||||
};
|
||||
|
||||
// Download metadata
|
||||
DlManager.downloadToMemory(
|
||||
@@ -163,7 +167,11 @@ std::shared_ptr<DownloadManager::FileFuture> ISWAManager::downloadImageToMemory(
|
||||
iSWAurl(id, "image"),
|
||||
buffer,
|
||||
[](const DownloadManager::FileFuture& f){
|
||||
LDEBUG("Download to memory finished");
|
||||
if(f.isFinished){
|
||||
LDEBUG("Download to memory finished");
|
||||
} else if (f.isAborted){
|
||||
LWARNING("Download to memory was aborted: " + f.errorMessage);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -173,7 +181,11 @@ std::shared_ptr<DownloadManager::FileFuture> ISWAManager::downloadDataToMemory(i
|
||||
iSWAurl(id, "data"),
|
||||
buffer,
|
||||
[](const DownloadManager::FileFuture& f){
|
||||
LDEBUG("Download data finished");
|
||||
if(f.isFinished){
|
||||
LDEBUG("Download to memory finished");
|
||||
} else if (f.isAborted){
|
||||
LWARNING("Download to memory was aborted: " + f.errorMessage);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -213,8 +225,12 @@ std::shared_ptr<MetadataFuture> ISWAManager::downloadMetadata(int id){
|
||||
// "http://10.0.0.76:3000/" + std::to_string(-id),
|
||||
metaFuture->json,
|
||||
[metaFuture](const DownloadManager::FileFuture& f){
|
||||
LDEBUG("Download to memory finished");
|
||||
metaFuture->isFinished = true;
|
||||
if(f.isFinished){
|
||||
metaFuture->isFinished;
|
||||
LDEBUG("Download to memory finished");
|
||||
} else if (f.isAborted){
|
||||
LWARNING("Download to memory was aborted: " + f.errorMessage);
|
||||
}
|
||||
}
|
||||
);
|
||||
return metaFuture;
|
||||
|
||||
@@ -227,26 +227,27 @@ std::shared_ptr<DownloadManager::FileFuture> DownloadManager::downloadToMemory(
|
||||
curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, xferinfo);
|
||||
curl_easy_setopt(curl, CURLOPT_XFERINFODATA, &p);
|
||||
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L);
|
||||
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 5L);
|
||||
|
||||
CURLcode res = curl_easy_perform(curl);
|
||||
if(res == CURLE_OK){
|
||||
// ask for the content-type
|
||||
char *ct;
|
||||
res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct);
|
||||
if(ct){
|
||||
if (res == CURLE_OK){
|
||||
future->format = std::string(ct);
|
||||
}
|
||||
}
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
|
||||
if (res == CURLE_OK)
|
||||
future->isFinished = true;
|
||||
else
|
||||
future->isFinished = true;
|
||||
}
|
||||
} else{
|
||||
future->errorMessage = curl_easy_strerror(res);
|
||||
|
||||
future->isAborted = true;
|
||||
}
|
||||
|
||||
if (finishedCallback)
|
||||
finishedCallback(*future);
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user