Introduced preliminary support for asynchronous file read requests,
ReaderWriter::ReadResult now has a FILE_REQUEST enum. ReaderWriter::Options now has a s/getAsynchronousFileReadHint() parameter methods. libcurl based plugin now detects enabing of the AsynchronousFileReadHint, but as yet does not handle async requests - handling everything syncronously. DatabasePager now by default will enable AsynchronousFileReadHint for http based file requests
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include <osgDB/DatabasePager>
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/FileNameUtils>
|
||||
|
||||
#include <osg/Geode>
|
||||
#include <osg/Timer>
|
||||
@@ -419,7 +420,22 @@ void DatabasePager::requestNodeFile(const std::string& fileName,osg::Group* grou
|
||||
databaseRequest->_timestampLastRequest = timestamp;
|
||||
databaseRequest->_priorityLastRequest = priority;
|
||||
databaseRequest->_groupForAddingLoadedSubgraph = group;
|
||||
databaseRequest->_loadOptions = loadOptions;
|
||||
|
||||
if ((Registry::instance()->getOptions()==loadOptions) &&
|
||||
(loadOptions ? !loadOptions->getAsynchronousFileReadHint() : true) &&
|
||||
osgDB::containsServerAddress(fileName))
|
||||
{
|
||||
// we need to enable asynchronous file reading.
|
||||
databaseRequest->_loadOptions = loadOptions ?
|
||||
dynamic_cast<osgDB::ReaderWriter::Options*>(loadOptions->clone(osg::CopyOp::SHALLOW_COPY)) :
|
||||
new osgDB::ReaderWriter::Options;
|
||||
|
||||
databaseRequest->_loadOptions->setAsynchronousFileReadHint(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
databaseRequest->_loadOptions = loadOptions;
|
||||
}
|
||||
|
||||
_fileRequestList.push_back(databaseRequest);
|
||||
|
||||
|
||||
@@ -316,6 +316,11 @@ class ReaderWriterCURL : public osgDB::ReaderWriter
|
||||
proxyAddress = std::string(proxyEnvAddress) + ":8080"; //Default
|
||||
}
|
||||
|
||||
bool asyncFileRead = options ? options->getAsynchronousFileReadHint() : false;
|
||||
|
||||
osg::notify(osg::INFO)<<"AsynchronousFileReadHint= "<<asyncFileRead<<std::endl;
|
||||
|
||||
// if (asyncFileRead) return ReadResult::FILE_REQUESTED;
|
||||
|
||||
std::stringstream buffer;
|
||||
ReadResult curlResult;
|
||||
|
||||
Reference in New Issue
Block a user