supressed deadlock in ftController due to calling ftServer from ftcontroller itself

This commit is contained in:
mr-alice 2016-11-02 20:51:42 +01:00
parent 02f442a400
commit d2118c5329
3 changed files with 507 additions and 507 deletions

View file

@ -581,7 +581,7 @@ void ftController::locked_checkQueueElement(uint32_t pos)
_queue[pos]->mState = ftFileControl::DOWNLOADING ; _queue[pos]->mState = ftFileControl::DOWNLOADING ;
if(_queue[pos]->mFlags & RS_FILE_REQ_ANONYMOUS_ROUTING) if(_queue[pos]->mFlags & RS_FILE_REQ_ANONYMOUS_ROUTING)
mFtServer->activateTunnels(_queue[pos]->mHash,_queue[pos]->mFlags,true); mFtServer->activateTunnels(_queue[pos]->mHash,mDefaultEncryptionPolicy,_queue[pos]->mFlags,true);
} }
if(pos >= _max_active_downloads && _queue[pos]->mState != ftFileControl::QUEUED && _queue[pos]->mState != ftFileControl::PAUSED) if(pos >= _max_active_downloads && _queue[pos]->mState != ftFileControl::QUEUED && _queue[pos]->mState != ftFileControl::PAUSED)
@ -590,7 +590,7 @@ void ftController::locked_checkQueueElement(uint32_t pos)
_queue[pos]->mCreator->closeFile() ; _queue[pos]->mCreator->closeFile() ;
if(_queue[pos]->mFlags & RS_FILE_REQ_ANONYMOUS_ROUTING) if(_queue[pos]->mFlags & RS_FILE_REQ_ANONYMOUS_ROUTING)
mFtServer->activateTunnels(_queue[pos]->mHash,_queue[pos]->mFlags,false); mFtServer->activateTunnels(_queue[pos]->mHash,mDefaultEncryptionPolicy,_queue[pos]->mFlags,false);
} }
} }
@ -834,7 +834,7 @@ bool ftController::completeFile(const RsFileHash& hash)
mDownloads.erase(it); mDownloads.erase(it);
if(flags & RS_FILE_REQ_ANONYMOUS_ROUTING) if(flags & RS_FILE_REQ_ANONYMOUS_ROUTING)
mFtServer->activateTunnels(hash_to_suppress,flags,false); mFtServer->activateTunnels(hash_to_suppress,mDefaultEncryptionPolicy,flags,false);
} // UNLOCK: RS_STACK_MUTEX(ctrlMutex); } // UNLOCK: RS_STACK_MUTEX(ctrlMutex);
@ -1188,7 +1188,7 @@ bool ftController::FileRequest(const std::string& fname, const RsFileHash& hash
// We check that flags are consistent. // We check that flags are consistent.
if(flags & RS_FILE_REQ_ANONYMOUS_ROUTING) if(flags & RS_FILE_REQ_ANONYMOUS_ROUTING)
mFtServer->activateTunnels(hash,flags,true); mFtServer->activateTunnels(hash,mDefaultEncryptionPolicy,flags,true);
bool assume_availability = false; bool assume_availability = false;
@ -1289,7 +1289,7 @@ bool ftController::setChunkStrategy(const RsFileHash& hash,FileChunksInfo::Chunk
bool ftController::FileCancel(const RsFileHash& hash) bool ftController::FileCancel(const RsFileHash& hash)
{ {
mFtServer->activateTunnels(hash,TransferRequestFlags(0),false); mFtServer->activateTunnels(hash,mDefaultEncryptionPolicy,TransferRequestFlags(0),false);
#ifdef CONTROL_DEBUG #ifdef CONTROL_DEBUG
std::cerr << "ftController::FileCancel" << std::endl; std::cerr << "ftController::FileCancel" << std::endl;

File diff suppressed because it is too large Load diff

View file

@ -219,7 +219,7 @@ public:
/*************** Data Transfer Interface ***********************/ /*************** Data Transfer Interface ***********************/
/***************************************************************/ /***************************************************************/
public: public:
virtual bool activateTunnels(const RsFileHash& hash,TransferRequestFlags flags,bool onoff); virtual bool activateTunnels(const RsFileHash& hash,uint32_t default_encryption_policy,TransferRequestFlags flags,bool onoff);
virtual bool sendData(const RsPeerId& peerId, const RsFileHash& hash, uint64_t size, uint64_t offset, uint32_t chunksize, void *data); virtual bool sendData(const RsPeerId& peerId, const RsFileHash& hash, uint64_t size, uint64_t offset, uint32_t chunksize, void *data);
virtual bool sendDataRequest(const RsPeerId& peerId, const RsFileHash& hash, uint64_t size, uint64_t offset, uint32_t chunksize); virtual bool sendDataRequest(const RsPeerId& peerId, const RsFileHash& hash, uint64_t size, uint64_t offset, uint32_t chunksize);