mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-03-01 19:31:27 -05:00
corrected bug about persistence of default chunk strategy
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2817 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
e5e43741d6
commit
6fee3eeeb7
@ -519,6 +519,7 @@ void ftController::locked_topQueue(uint32_t pos)
|
|||||||
locked_checkQueueElement(p) ;
|
locked_checkQueueElement(p) ;
|
||||||
}
|
}
|
||||||
_queue[0]=tmp ;
|
_queue[0]=tmp ;
|
||||||
|
|
||||||
locked_checkQueueElement(0) ;
|
locked_checkQueueElement(0) ;
|
||||||
}
|
}
|
||||||
void ftController::locked_bottomQueue(uint32_t pos)
|
void ftController::locked_bottomQueue(uint32_t pos)
|
||||||
@ -552,8 +553,11 @@ void ftController::locked_checkQueueElement(uint32_t pos)
|
|||||||
{
|
{
|
||||||
_queue[pos]->mQueuePosition = pos ;
|
_queue[pos]->mQueuePosition = pos ;
|
||||||
|
|
||||||
if(pos < _max_active_downloads)
|
if(pos < _max_active_downloads && _queue[pos]->mState != ftFileControl::PAUSED)
|
||||||
{
|
{
|
||||||
|
if(_queue[pos]->mState == ftFileControl::QUEUED)
|
||||||
|
_queue[pos]->mCreator->resetRecvTimeStamp() ;
|
||||||
|
|
||||||
_queue[pos]->mState = ftFileControl::DOWNLOADING ;
|
_queue[pos]->mState = ftFileControl::DOWNLOADING ;
|
||||||
|
|
||||||
if(_queue[pos]->mFlags & RS_FILE_HINTS_NETWORK_WIDE)
|
if(_queue[pos]->mFlags & RS_FILE_HINTS_NETWORK_WIDE)
|
||||||
@ -1150,6 +1154,9 @@ bool ftController::FileRequest(std::string fname, std::string hash,
|
|||||||
ftFileCreator *fc = new ftFileCreator(savepath, size, hash);
|
ftFileCreator *fc = new ftFileCreator(savepath, size, hash);
|
||||||
ftTransferModule *tm = new ftTransferModule(fc, mDataplex,this);
|
ftTransferModule *tm = new ftTransferModule(fc, mDataplex,this);
|
||||||
|
|
||||||
|
#ifdef CONTROL_DEBUG
|
||||||
|
std::cerr << "Note: setting chunk strategy to " << mDefaultChunkStrategy <<std::endl ;
|
||||||
|
#endif
|
||||||
fc->setChunkStrategy(mDefaultChunkStrategy) ;
|
fc->setChunkStrategy(mDefaultChunkStrategy) ;
|
||||||
|
|
||||||
/* add into maps */
|
/* add into maps */
|
||||||
@ -1950,9 +1957,17 @@ bool ftController::loadConfigMap(std::map<std::string, std::string> &configMap)
|
|||||||
if (configMap.end() != (mit = configMap.find(default_chunk_strategy_ss)))
|
if (configMap.end() != (mit = configMap.find(default_chunk_strategy_ss)))
|
||||||
{
|
{
|
||||||
if(mit->second == "STREAMING")
|
if(mit->second == "STREAMING")
|
||||||
|
{
|
||||||
setDefaultChunkStrategy(FileChunksInfo::CHUNK_STRATEGY_STREAMING) ;
|
setDefaultChunkStrategy(FileChunksInfo::CHUNK_STRATEGY_STREAMING) ;
|
||||||
|
std::cerr << "Note: loading default value for chunk strategy: streaming" << std::endl;
|
||||||
|
}
|
||||||
else if(mit->second == "RANDOM")
|
else if(mit->second == "RANDOM")
|
||||||
|
{
|
||||||
setDefaultChunkStrategy(FileChunksInfo::CHUNK_STRATEGY_RANDOM) ;
|
setDefaultChunkStrategy(FileChunksInfo::CHUNK_STRATEGY_RANDOM) ;
|
||||||
|
std::cerr << "Note: loading default value for chunk strategy: random" << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
std::cerr << "**** ERROR ***: Unknown value for default chunk strategy in keymap." << std::endl ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -1966,6 +1981,9 @@ FileChunksInfo::ChunkStrategy ftController::defaultChunkStrategy()
|
|||||||
void ftController::setDefaultChunkStrategy(FileChunksInfo::ChunkStrategy S)
|
void ftController::setDefaultChunkStrategy(FileChunksInfo::ChunkStrategy S)
|
||||||
{
|
{
|
||||||
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
|
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
|
||||||
|
#ifdef CONTROL_DEBUG
|
||||||
|
std::cerr << "Note: in frController: setting chunk strategy to " << S << std::endl ;
|
||||||
|
#endif
|
||||||
mDefaultChunkStrategy = S ;
|
mDefaultChunkStrategy = S ;
|
||||||
IndicateConfigChanged() ;
|
IndicateConfigChanged() ;
|
||||||
}
|
}
|
||||||
|
@ -272,9 +272,9 @@ bool ftServer::setChunkStrategy(const std::string& hash,FileChunksInfo::ChunkStr
|
|||||||
{
|
{
|
||||||
return mFtController->setChunkStrategy(hash,s);
|
return mFtController->setChunkStrategy(hash,s);
|
||||||
}
|
}
|
||||||
void ftServer::setDefaultChunkStrategy(FileChunksInfo::ChunkStrategy)
|
void ftServer::setDefaultChunkStrategy(FileChunksInfo::ChunkStrategy s)
|
||||||
{
|
{
|
||||||
mFtController->defaultChunkStrategy() ;
|
mFtController->setDefaultChunkStrategy(s) ;
|
||||||
}
|
}
|
||||||
FileChunksInfo::ChunkStrategy ftServer::defaultChunkStrategy()
|
FileChunksInfo::ChunkStrategy ftServer::defaultChunkStrategy()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user