From e8c43c868f28b13fc6536a55a20fe8b3880f581a Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sun, 3 Sep 2006 19:53:19 +0000 Subject: [PATCH] updated dump_torrent examples to print DHT nodes from the torrent file --- Jamfile | 9 --------- docs/examples.html | 9 +++++++++ docs/examples.rst | 9 +++++++++ examples/dump_torrent.cpp | 8 ++++++++ 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/Jamfile b/Jamfile index 3d98f4bd3..7572f5139 100755 --- a/Jamfile +++ b/Jamfile @@ -135,15 +135,6 @@ LIBS = ; LIBS += wsock32 ; } -#lib torrent -# : -# src/$(SOURCES) -# src/$(KADEMLIA_SOURCES) -# zlib/$(ZLIB_SOURCES) -# $(LIBS) -# ; - -# if DHT support is disabled, don't include the kademlia sources lib torrent : src/$(SOURCES) diff --git a/docs/examples.html b/docs/examples.html index f6af367a4..7e15f2235 100644 --- a/docs/examples.html +++ b/docs/examples.html @@ -74,6 +74,15 @@ int main(int argc, char* argv[]) // print info about torrent std::cout << "\n\n----- torrent file info -----\n\n"; + std::cout << "nodes:\n"; + typedef std::vector<std::pair<std::string, int> > node_vec; + node_vec const& nodes = t.nodes(); + for (node_vec::const_iterator i = nodes.begin(), end(nodes.end()); + i != end; ++i) + { + std::cout << i->first << ":" << i->second << "\n"; + } + std::cout << "trackers:\n"; for (std::vector<announce_entry>::const_iterator i = t.trackers().begin(); i != t.trackers().end(); ++i) diff --git a/docs/examples.rst b/docs/examples.rst index e093daddc..cd8e21cf6 100644 --- a/docs/examples.rst +++ b/docs/examples.rst @@ -58,6 +58,15 @@ print information about it to std out:: // print info about torrent std::cout << "\n\n----- torrent file info -----\n\n"; + std::cout << "nodes:\n"; + typedef std::vector > node_vec; + node_vec const& nodes = t.nodes(); + for (node_vec::const_iterator i = nodes.begin(), end(nodes.end()); + i != end; ++i) + { + std::cout << i->first << ":" << i->second << "\n"; + } + std::cout << "trackers:\n"; for (std::vector::const_iterator i = t.trackers().begin(); i != t.trackers().end(); ++i) diff --git a/examples/dump_torrent.cpp b/examples/dump_torrent.cpp index d3bd47f80..53d29c493 100755 --- a/examples/dump_torrent.cpp +++ b/examples/dump_torrent.cpp @@ -65,6 +65,14 @@ int main(int argc, char* argv[]) // print info about torrent std::cout << "\n\n----- torrent file info -----\n\n"; + std::cout << "nodes:\n"; + typedef std::vector > node_vec; + node_vec const& nodes = t.nodes(); + for (node_vec::const_iterator i = nodes.begin(), end(nodes.end()); + i != end; ++i) + { + std::cout << i->first << ":" << i->second << "\n"; + } std::cout << "trackers:\n"; for (std::vector::const_iterator i = t.trackers().begin(); i != t.trackers().end(); ++i)