diff --git a/src/twister.cpp b/src/twister.cpp index 71feab05..9f427524 100644 --- a/src/twister.cpp +++ b/src/twister.cpp @@ -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());