From 9a3d77b4000e8fdb2e9217883e0e2fcf19867725 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Mon, 30 Apr 2012 21:08:43 +0000 Subject: [PATCH] delete duplicate code and fix metadata issue where piece refcounts would be counted up twice --- src/peer_connection.cpp | 47 ----------------------------------------- 1 file changed, 47 deletions(-) diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index ff6ae4407..8e2786554 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -805,55 +805,8 @@ namespace libtorrent } i = m_suggested_pieces.erase(i); } - - if (m_num_pieces == int(m_have_piece.size())) - { -#ifdef TORRENT_VERBOSE_LOGGING - peer_log("*** on_metadata(): THIS IS A SEED [ p: %p ]", m_peer_info); -#endif - // if this is a web seed. we don't have a peer_info struct - t->get_policy().set_seed(m_peer_info, true); - m_upload_only = true; - - t->peer_has_all(); - disconnect_if_redundant(); - if (m_disconnecting) return; - - on_metadata(); - if (m_disconnecting) return; - - if (!t->is_upload_only()) - t->get_policy().peer_is_interesting(*this); - - return; - } - TORRENT_ASSERT(!m_have_all); - on_metadata(); if (m_disconnecting) return; - - disconnect_if_redundant(); - if (m_disconnecting) return; - - // let the torrent know which pieces the - // peer has - // if we're a seed, we don't keep track of piece availability - bool interesting = false; - if (!t->is_seed()) - { - t->peer_has(m_have_piece); - - for (int i = 0; i < (int)m_have_piece.size(); ++i) - { - if (!m_have_piece[i]) continue; - if (t->have_piece(i) || t->picker().piece_priority(i) == 0) continue; - interesting = true; - break; - } - } - - if (interesting) t->get_policy().peer_is_interesting(*this); - else if (upload_only()) disconnect(errors::upload_upload_connection); } void peer_connection::init()