updated dump_torrent examples to print DHT nodes from the torrent file

This commit is contained in:
Arvid Norberg 2006-09-03 19:53:19 +00:00
parent 35c6fc413c
commit e8c43c868f
4 changed files with 26 additions and 9 deletions

View File

@ -135,15 +135,6 @@ LIBS = ;
LIBS += wsock32 ; 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 lib torrent
: :
src/$(SOURCES) src/$(SOURCES)

View File

@ -74,6 +74,15 @@ int main(int argc, char* argv[])
// print info about torrent // print info about torrent
std::cout << "\n\n----- torrent file info -----\n\n"; 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"; std::cout << "trackers:\n";
for (std::vector<announce_entry>::const_iterator i for (std::vector<announce_entry>::const_iterator i
= t.trackers().begin(); i != t.trackers().end(); ++i) = t.trackers().begin(); i != t.trackers().end(); ++i)

View File

@ -58,6 +58,15 @@ print information about it to std out::
// print info about torrent // print info about torrent
std::cout << "\n\n----- torrent file info -----\n\n"; 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"; std::cout << "trackers:\n";
for (std::vector<announce_entry>::const_iterator i for (std::vector<announce_entry>::const_iterator i
= t.trackers().begin(); i != t.trackers().end(); ++i) = t.trackers().begin(); i != t.trackers().end(); ++i)

View File

@ -65,6 +65,14 @@ int main(int argc, char* argv[])
// print info about torrent // print info about torrent
std::cout << "\n\n----- torrent file info -----\n\n"; 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"; std::cout << "trackers:\n";
for (std::vector<announce_entry>::const_iterator i = t.trackers().begin(); for (std::vector<announce_entry>::const_iterator i = t.trackers().begin();
i != t.trackers().end(); ++i) i != t.trackers().end(); ++i)