fix deadlock

This commit is contained in:
Miguel Freitas 2013-11-01 15:13:37 -02:00
parent 6594b01e6f
commit 22161a71ed

View File

@ -69,8 +69,10 @@ sha1_hash dhtTargetHash(std::string const &username, std::string const &resource
torrent_handle startTorrentUser(std::string const &username)
{
bool userInTxDb = usernameExists(username); // keep this outside cs_twister to avoid deadlock
LOCK(cs_twister);
if( !m_userTorrent.count(username) && usernameExists(username) ) {
if( !m_userTorrent.count(username) && userInTxDb ) {
sha1_hash ih = dhtTargetHash(username, "tracker", "m");
printf("adding torrent for [%s,tracker]\n", username.c_str());