mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
corrected quite subtle bug in ftdatamultiplex, due to deleting a filecreator that is also a file server.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3879 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
90211debe9
commit
9ec813b4b8
@ -87,6 +87,7 @@ bool ftDataMultiplex::addTransferModule(ftTransferModule *mod, ftFileCreator *f)
|
|||||||
bool ftDataMultiplex::removeTransferModule(std::string hash)
|
bool ftDataMultiplex::removeTransferModule(std::string hash)
|
||||||
{
|
{
|
||||||
RsStackMutex stack(dataMtx); /******* LOCK MUTEX ******/
|
RsStackMutex stack(dataMtx); /******* LOCK MUTEX ******/
|
||||||
|
|
||||||
std::map<std::string, ftClient>::iterator it;
|
std::map<std::string, ftClient>::iterator it;
|
||||||
if (mClients.end() == (it = mClients.find(hash)))
|
if (mClients.end() == (it = mClients.find(hash)))
|
||||||
{
|
{
|
||||||
@ -94,6 +95,20 @@ bool ftDataMultiplex::removeTransferModule(std::string hash)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
mClients.erase(it);
|
mClients.erase(it);
|
||||||
|
|
||||||
|
// This is very important to delete the hash from servers as well, because
|
||||||
|
// after removing the transfer module, ftController will delete the fileCreator.
|
||||||
|
// If the file creator is also a server in use, then it will cause a crash
|
||||||
|
// at the next server request.
|
||||||
|
//
|
||||||
|
// With the current action, the next server request will re-create the server as
|
||||||
|
// a ftFileProvider.
|
||||||
|
//
|
||||||
|
std::map<std::string, ftFileProvider*>::iterator sit = mServers.find(hash) ;
|
||||||
|
|
||||||
|
if(sit != mServers.end())
|
||||||
|
mServers.erase(sit);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user