diff --git a/src/session_impl.cpp b/src/session_impl.cpp index b7adc7fb0..8be95bcc0 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -5287,7 +5287,15 @@ retry: // is the torrent already active? boost::shared_ptr torrent_ptr = find_torrent(*ih).lock(); if (!torrent_ptr && !params.uuid.empty()) torrent_ptr = find_torrent(params.uuid).lock(); - // TODO: 2 if we still can't find the torrent, we should probably look for it by url here + // if we still can't find the torrent, look for it by url + if (!torrent_ptr && !params.url.empty()) + { + std::map >::iterator i = std::find_if(m_torrents.begin() + , m_torrents.end(), boost::bind(&torrent::url, boost::bind(&std::pair >::second, _1)) == params.url); + if (i != m_torrents.end()) + torrent_ptr = i->second; + } if (torrent_ptr) {