y500 / libtorrent

Automatically exported from code.google.com/p/libtorrent
0 stars 0 forks source link

asserts then removing http seed in trunk #715

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. add a torrent with a failing http seed to the session (i.e. http 404)
2. try to remove this http seed with torrent_handle::remove_http_seed()

I get several different asserts (of course only if I ignore them within the 
debugger)

Original issue reported on code.google.com by webmas...@massaroddel.de on 28 Dec 2014 at 3:46

GoogleCodeExporter commented 8 years ago
I can't reproduce this, which assert do you hit?

Original comment by arvid.no...@gmail.com on 30 Dec 2014 at 4:44

GoogleCodeExporter commented 8 years ago
I get the assert not everytime but i could make it happen again.

void peer_connection::set_peer_info(torrent_peer* pi)
{
    TORRENT_ASSERT(m_peer_info == 0 || pi == 0 );
--->    TORRENT_ASSERT(pi != NULL || m_disconnect_started);
    m_peer_info = pi;
}

pi = NULL

called from
void torrent::remove_web_seed(std::list<web_seed_entry>::iterator web)
{
    if (web->resolving)
    {
        web->removed = true;
        return;
    }
    peer_connection* peer = static_cast<peer_connection*>(web->peer_info.connection);
    if (peer) {
        TORRENT_ASSERT(peer->m_in_use == 1337);
---->       peer->set_peer_info(0);
    }
    if (has_picker()) picker().clear_peer(&web->peer_info);

    m_web_seeds.erase(web);
    update_want_tick();
}

last time i did not check the call stack but obviously it has to assert

if i ignore that assert - the next one (this time) was in 

void torrent::retry_web_seed(peer_connection* p, int retry)
{
    TORRENT_ASSERT(is_single_thread());
    std::list<web_seed_entry>::iterator i = std::find_if(m_web_seeds.begin(), m_web_seeds.end()
            , (boost::bind(&torrent_peer::connection, boost::bind(&web_seed_entry::peer_info, _1)) == p));

--->    TORRENT_ASSERT(i != m_web_seeds.end());
    if (i == m_web_seeds.end()) return;
    if (retry == 0) retry = m_ses.settings().get_int(settings_pack::urlseed_wait_retry);
    i->retry = time_now() + seconds(retry);
}

m_web_seeds size was 0

called from  web_peer_connection::on_receive

Original comment by webmas...@massaroddel.de on 30 Dec 2014 at 6:17

GoogleCodeExporter commented 8 years ago
thanks! fixed in [10655].

Original comment by arvid.no...@gmail.com on 31 Dec 2014 at 9:30