diff options
author | Peter Alfredsen <loki_val@gentoo.org> | 2008-08-26 21:17:16 +0000 |
---|---|---|
committer | Peter Alfredsen <loki_val@gentoo.org> | 2008-08-26 21:17:16 +0000 |
commit | 84c90f974720d1e888fe3effb792f5185fb5f5a0 (patch) | |
tree | 5ff005bac7b5f57f91ff44e9d56675fde8e8cc2c /net-libs | |
parent | New pretest version. (diff) | |
download | gentoo-2-84c90f974720d1e888fe3effb792f5185fb5f5a0.tar.gz gentoo-2-84c90f974720d1e888fe3effb792f5185fb5f5a0.tar.bz2 gentoo-2-84c90f974720d1e888fe3effb792f5185fb5f5a0.zip |
Fixes an interoperability issue in the get_peers handling, now it behaves according to the clarified BEP-0005. Also fixes a minor issue of not being able to generate error packets. Patch by Josef Drexler.
(Portage version: 2.2_rc8/cvs/Linux 2.6.25.8 i686)
Diffstat (limited to 'net-libs')
-rw-r--r-- | net-libs/libtorrent/ChangeLog | 11 | ||||
-rw-r--r-- | net-libs/libtorrent/files/libtorrent-0.12.2-fix_dht-get_peers.patch | 140 | ||||
-rw-r--r-- | net-libs/libtorrent/libtorrent-0.12.2-r4.ebuild | 60 |
3 files changed, 210 insertions, 1 deletions
diff --git a/net-libs/libtorrent/ChangeLog b/net-libs/libtorrent/ChangeLog index 16dce22f0cf7..622ab3b46842 100644 --- a/net-libs/libtorrent/ChangeLog +++ b/net-libs/libtorrent/ChangeLog @@ -1,6 +1,15 @@ # ChangeLog for net-libs/libtorrent # Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-libs/libtorrent/ChangeLog,v 1.122 2008/08/25 20:19:48 jer Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-libs/libtorrent/ChangeLog,v 1.123 2008/08/26 21:17:15 loki_val Exp $ + +*libtorrent-0.12.2-r4 (26 Aug 2008) + + 26 Aug 2008; Peter Alfredsen <loki_val@gentoo.org> + +files/libtorrent-0.12.2-fix_dht-get_peers.patch, + +libtorrent-0.12.2-r4.ebuild: + Fixes an interoperability issue in the get_peers handling, now it behaves + according to the clarified BEP-0005. Also fixes a minor issue of not being + able to generate error packets. Patch by Josef Drexler. 25 Aug 2008; Jeroen Roovers <jer@gentoo.org> libtorrent-0.12.2-r3.ebuild: Stable for HPPA (bug #233122). diff --git a/net-libs/libtorrent/files/libtorrent-0.12.2-fix_dht-get_peers.patch b/net-libs/libtorrent/files/libtorrent-0.12.2-fix_dht-get_peers.patch new file mode 100644 index 000000000000..b447749f9495 --- /dev/null +++ b/net-libs/libtorrent/files/libtorrent-0.12.2-fix_dht-get_peers.patch @@ -0,0 +1,140 @@ +# Fixes an interoperability issue in the get_peers handling, now it +# behaves according to the clarified BEP-0005. Also fixes a minor +# issue of not being able to generate error packets. +Index: libtorrent/src/dht/dht_tracker.h +=================================================================== +--- libtorrent/src/dht/dht_tracker.h (revision 1063) ++++ libtorrent/src/dht/dht_tracker.h (working copy) +@@ -65,7 +65,7 @@ + size_t size() const { return m_peers.size(); } + + void add_peer(uint32_t addr, uint16_t port); +- std::string get_peers(unsigned int maxPeers = max_peers); ++ Object get_peers(unsigned int maxPeers = max_peers); + + // Remove old announces from the tracker that have not reannounced for + // more than the given number of seconds. +Index: libtorrent/src/dht/dht_transaction.cc +=================================================================== +--- libtorrent/src/dht/dht_transaction.cc (revision 1063) ++++ libtorrent/src/dht/dht_transaction.cc (working copy) +@@ -252,7 +252,7 @@ + } + + void +-DhtAnnounce::receive_peers(const std::string& peers) { ++DhtAnnounce::receive_peers(const Object& peers) { + m_tracker->receive_peers(peers); + } + +Index: libtorrent/src/dht/dht_server.cc +=================================================================== +--- libtorrent/src/dht/dht_server.cc (revision 1063) ++++ libtorrent/src/dht/dht_server.cc (working copy) +@@ -302,8 +302,7 @@ + reply.insert_key("nodes", std::string(compact, end)); + + } else { +- Object& values = reply.insert_key("values", Object::create_list()); +- values.insert_back(tracker->get_peers()); ++ reply.insert_key("values", Object::create_list()).as_list().swap(tracker->get_peers().as_list()); + } + } + +@@ -417,7 +416,7 @@ + transaction->complete(true); + + if (response.has_key_list("values")) +- announce->receive_peers((*response.get_key_list("values").begin()).as_string()); ++ announce->receive_peers(response.get_key("values")); + + if (response.has_key_string("token")) + add_transaction(new DhtTransactionAnnouncePeer(transaction->id(), transaction->address(), announce->target(), response.get_key_string("token")), packet_prio_low); +@@ -641,6 +640,7 @@ + sstream.imbue(std::locale::classic()); + + while (true) { ++ Object request; + rak::socket_address sa; + int type = '?'; + const Object* transactionId = NULL; +@@ -656,7 +656,6 @@ + total += read; + sstream.str(std::string(buffer, read)); + +- Object request; + sstream >> request; + + // If it's not a valid bencode dictionary at all, it's probably not a DHT +Index: libtorrent/src/dht/dht_transaction.h +=================================================================== +--- libtorrent/src/dht/dht_transaction.h (revision 1063) ++++ libtorrent/src/dht/dht_transaction.h (working copy) +@@ -178,7 +178,7 @@ + // counts announces instead. + const_accessor start_announce(); + +- void receive_peers(const std::string& peers); ++ void receive_peers(const Object& peer_list); + void update_status(); + + private: +Index: libtorrent/src/dht/dht_tracker.cc +=================================================================== +--- libtorrent/src/dht/dht_tracker.cc (revision 1063) ++++ libtorrent/src/dht/dht_tracker.cc (working copy) +@@ -79,7 +79,7 @@ + + // Return compact info (6 bytes) for up to 30 peers, returning different + // peers for each call if there are more. +-std::string ++Object + DhtTracker::get_peers(unsigned int maxPeers) { + PeerList::iterator first = m_peers.begin(); + PeerList::iterator last = m_peers.end(); +@@ -94,7 +94,11 @@ + last = first + maxPeers; + } + +- return std::string(first->c_str(), last->c_str()); ++ Object peers = Object::create_list(); ++ for (; first != last; ++first) ++ peers.insert_back(std::string(first->c_str(), sizeof(*first))); ++ ++ return peers; + } + + // Remove old announces. +Index: libtorrent/src/tracker/tracker_dht.h +=================================================================== +--- libtorrent/src/tracker/tracker_dht.h (revision 1063) ++++ libtorrent/src/tracker/tracker_dht.h (working copy) +@@ -71,7 +71,7 @@ + + bool has_peers() const { return !m_peers.empty(); } + +- void receive_peers(const std::string& peers); ++ void receive_peers(const Object& peer_list); + void receive_success(); + void receive_failed(const char* msg); + void receive_progress(int replied, int contacted); +Index: libtorrent/src/tracker/tracker_dht.cc +=================================================================== +--- libtorrent/src/tracker/tracker_dht.cc (revision 1063) ++++ libtorrent/src/tracker/tracker_dht.cc (working copy) +@@ -114,11 +114,13 @@ + } + + void +-TrackerDht::receive_peers(const std::string& peers) { ++TrackerDht::receive_peers(const Object& peer_list) { + if (!is_busy()) + throw internal_error("TrackerDht::receive_peers called while not busy."); + +- m_peers.parse_address_compact(peers); ++ Object::list_type peers = peer_list.as_list(); ++ for (Object::list_type::const_iterator itr = peers.begin(); itr != peers.end(); ++itr) ++ m_peers.parse_address_compact(itr->as_string()); + } + + void diff --git a/net-libs/libtorrent/libtorrent-0.12.2-r4.ebuild b/net-libs/libtorrent/libtorrent-0.12.2-r4.ebuild new file mode 100644 index 000000000000..be18da686c3b --- /dev/null +++ b/net-libs/libtorrent/libtorrent-0.12.2-r4.ebuild @@ -0,0 +1,60 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-libs/libtorrent/libtorrent-0.12.2-r4.ebuild,v 1.1 2008/08/26 21:17:15 loki_val Exp $ + +inherit autotools eutils toolchain-funcs flag-o-matic libtool + +DESCRIPTION="LibTorrent is a BitTorrent library written in C++ for *nix." +HOMEPAGE="http://libtorrent.rakshasa.no/" +SRC_URI="http://libtorrent.rakshasa.no/downloads/${P}.tar.gz" +SLOT="0" +LICENSE="GPL-2" +KEYWORDS="~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd" + +IUSE="debug ipv6" + +RDEPEND=">=dev-libs/libsigc++-2" +DEPEND="${RDEPEND} + dev-util/pkgconfig" + +src_unpack() { + unpack ${A} + cd "${S}" + epatch "${FILESDIR}"/${PN}-0.11.9+gcc-4.3.patch + epatch "${FILESDIR}"/${P}-dht_bounds_fix.patch + epatch "${FILESDIR}"/${P}-fix_cull.patch + epatch "${FILESDIR}"/${P}-fix_dht_target.patch + epatch "${FILESDIR}"/${P}-fix_have_timer.patch + epatch "${FILESDIR}"/${P}-fix_pex_leak.patch + epatch "${FILESDIR}"/${P}-fix_write_datagram.patch + epatch "${FILESDIR}"/${P}-lt-ver.patch + epatch "${FILESDIR}"/${P}-tracker_timer_fix.patch + epatch "${FILESDIR}"/${P}-fix_dht-get_peers.patch + + elibtoolize #Don't remove + eautoreconf +} + +src_compile() { + replace-flags -Os -O2 + + if [[ $(tc-arch) = "x86" ]]; then + filter-flags -fomit-frame-pointer -fforce-addr + fi + + econf \ + $(use_enable debug) \ + $(use_enable ipv6) \ + --enable-aligned \ + --enable-static \ + --enable-shared \ + --disable-dependency-tracking \ + || die "econf failed" + + emake || die "emake failed" +} + +src_install() { + emake DESTDIR="${D}" install || die "make install failed" + dodoc AUTHORS NEWS README +} |