removed deadlock situation in data multiplex

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5.0@3185 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2010-06-21 19:00:00 +00:00
parent 10565a1fe7
commit 1c9bcb53e8

View File

@ -494,24 +494,29 @@ bool ftDataMultiplex::handleRecvData(const std::string& peerId,
const std::string& hash, uint64_t size, const std::string& hash, uint64_t size,
uint64_t offset, uint32_t chunksize, void *data) uint64_t offset, uint32_t chunksize, void *data)
{ {
RsStackMutex stack(dataMtx); /******* LOCK MUTEX ******/ ftTransferModule *transfer_module = NULL ;
std::map<std::string, ftClient>::iterator it;
if (mClients.end() == (it = mClients.find(hash)))
{ {
RsStackMutex stack(dataMtx); /******* LOCK MUTEX ******/
std::map<std::string, ftClient>::iterator it;
if (mClients.end() == (it = mClients.find(hash)))
{
#ifdef MPLEX_DEBUG #ifdef MPLEX_DEBUG
std::cerr << "ftDataMultiplex::handleRecvData() ERROR: No matching Client!"; std::cerr << "ftDataMultiplex::handleRecvData() ERROR: No matching Client!";
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
/* error */ /* error */
return false; return false;
} }
#ifdef MPLEX_DEBUG #ifdef MPLEX_DEBUG
std::cerr << "ftDataMultiplex::handleRecvData() Passing to Module"; std::cerr << "ftDataMultiplex::handleRecvData() Passing to Module";
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
(it->second).mModule->recvFileData(peerId, offset, chunksize, data); transfer_module = (it->second).mModule ;
}
transfer_module->recvFileData(peerId, offset, chunksize, data);
return true; return true;
} }