Discussion:
[libtorrent] dht.dht_nodes
Michael Mckeown
2016-05-09 14:45:01 UTC
Permalink
dht.dht_nodes always returns 0.

I believe I have things set up correctly as a trackerless torrent will
happily download:

std::vector<stats_metric> map = session_stats_metrics ( );
for ( std::vector<stats_metric>::const_iterator i = map.begin ( );
i != map.end ( ); ++i )
{
if ( i->name == "dht.dht_nodes" )
{
statistics.dht_nodes = i->value_index;
}
}

------

Client_Session->post_session_stats ( );
std::vector<libtorrent::alert*> alerts;
Client_Session->pop_alerts ( &alerts );

for ( libtorrent::alert const* a : alerts )
{
if ( auto se = libtorrent::alert_cast<
libtorrent::session_stats_alert >( a ) )
{
std::string nodes = std::to_string ( se->values [
statistics.dht_nodes ] );
std::cout << "DHT Nodes: " << nodes << "\n";
}
}

that's how I'm doing things,
peer.num_peers_connected/net.sent_payload_bytes/net.recv_payload_bytes/net.has_incoming_connections
work as expected via the above method.

Any pointers on how to fix this?

Thanks.
Alden Torres
2016-05-09 15:09:34 UTC
Permalink
That counter lost any update at some early point in the RC_1_1. Can't tell
you why, but it seems to my like a costly operation if you want frequent
stats update. What I do is request a dht_stats_alert and perform this loop:
https://github.com/frostwire/frostwire-jlibtorrent/blob/master/swig/libtorrent.i#L1147


G+ http://www.google.com/profiles/aldenml
Post by Michael Mckeown
dht.dht_nodes always returns 0.
I believe I have things set up correctly as a trackerless torrent will
std::vector<stats_metric> map = session_stats_metrics ( );
for ( std::vector<stats_metric>::const_iterator i = map.begin ( );
i != map.end ( ); ++i )
{
if ( i->name == "dht.dht_nodes" )
{
statistics.dht_nodes = i->value_index;
}
}
------
Client_Session->post_session_stats ( );
std::vector<libtorrent::alert*> alerts;
Client_Session->pop_alerts ( &alerts );
for ( libtorrent::alert const* a : alerts )
{
if ( auto se = libtorrent::alert_cast<
libtorrent::session_stats_alert >( a ) )
{
std::string nodes = std::to_string ( se->values [
statistics.dht_nodes ] );
std::cout << "DHT Nodes: " << nodes << "\n";
}
}
that's how I'm doing things,
peer.num_peers_connected/net.sent_payload_bytes/net.recv_payload_bytes/net.has_incoming_connections
work as expected via the above method.
Any pointers on how to fix this?
Thanks.
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications
Manager
Applications Manager provides deep performance insights into multiple
tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
Michael Mckeown
2016-05-09 15:26:24 UTC
Permalink
aldenml<http://www.google.com/profiles/aldenml>, thank you!

On 09/05/2016 16:09, Alden Torres wrote:

That counter lost any update at some early point in the RC_1_1. Can't tell
you why, but it seems to my like a costly operation if you want frequent
stats update. What I do is request a dht_stats_alert and perform this loop:
https://github.com/frostwire/frostwire-jlibtorrent/blob/master/swig/libtorrent.i#L1147


G+ http://www.google.com/profiles/aldenml

On Mon, May 9, 2016 at 10:45 AM, Michael Mckeown <***@outlook.com<mailto:***@outlook.com>


wrote:





dht.dht_nodes always returns 0.

I believe I have things set up correctly as a trackerless torrent will
happily download:

std::vector<stats_metric> map = session_stats_metrics ( );
for ( std::vector<stats_metric>::const_iterator i = map.begin ( );
i != map.end ( ); ++i )
{
if ( i->name == "dht.dht_nodes" )
{
statistics.dht_nodes = i->value_index;
}
}

------

Client_Session->post_session_stats ( );
std::vector<libtorrent::alert*> alerts;
Client_Session->pop_alerts ( &alerts );

for ( libtorrent::alert const* a : alerts )
{
if ( auto se = libtorrent::alert_cast<
libtorrent::session_stats_alert >( a ) )
{
std::string nodes = std::to_string ( se->values [
statistics.dht_nodes ] );
std::cout << "DHT Nodes: " << nodes << "\n";
}
}

that's how I'm doing things,

peer.num_peers_connected/net.sent_payload_bytes/net.recv_payload_bytes/net.has_incoming_connections
work as expected via the above method.

Any pointers on how to fix this?

Thanks.

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications
Manager
Applications Manager provides deep performance insights into multiple
tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Libtorrent-discuss mailing list
Libtorrent-***@lists.sourceforge.net<mailto:Libtorrent-***@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss



------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Libtorrent-discuss mailing list
Libtorrent-***@lists.sourceforge.net<mailto:Libtorrent-***@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
Arvid Norberg
2016-05-09 21:42:49 UTC
Permalink
Post by Michael Mckeown
dht.dht_nodes always returns 0.
I believe I have things set up correctly as a trackerless torrent will
std::vector<stats_metric> map = session_stats_metrics ( );
for ( std::vector<stats_metric>::const_iterator i = map.begin ( );
i != map.end ( ); ++i )
{
if ( i->name == "dht.dht_nodes" )
This comparison looks suspicious. Are you sure this isn't a pointer
comparison?
Post by Michael Mckeown
{
statistics.dht_nodes = i->value_index;
}
}
[...]
that's how I'm doing things,
peer.num_peers_connected/net.sent_payload_bytes/net.recv_payload_bytes/net.has_incoming_connections
work as expected via the above method.
Any pointers on how to fix this?
It looks like there's a bug in libtorrent where some DHT counters are not
updated. I'll fix this in RC_1_1 (for the next 1.1 release).
--
Arvid Norberg
Arvid Norberg
2016-05-11 02:06:18 UTC
Permalink
Please give this patch a try: https://github.com/arvidn/libtorrent/pull/720
Post by Michael Mckeown
On Mon, May 9, 2016 at 10:45 AM, Michael Mckeown <
Post by Michael Mckeown
dht.dht_nodes always returns 0.
I believe I have things set up correctly as a trackerless torrent will
std::vector<stats_metric> map = session_stats_metrics ( );
for ( std::vector<stats_metric>::const_iterator i = map.begin ( );
i != map.end ( ); ++i )
{
if ( i->name == "dht.dht_nodes" )
This comparison looks suspicious. Are you sure this isn't a pointer
comparison?
Post by Michael Mckeown
{
statistics.dht_nodes = i->value_index;
}
}
[...]
that's how I'm doing things,
peer.num_peers_connected/net.sent_payload_bytes/net.recv_payload_bytes/net.has_incoming_connections
work as expected via the above method.
Any pointers on how to fix this?
It looks like there's a bug in libtorrent where some DHT counters are not
updated. I'll fix this in RC_1_1 (for the next 1.1 release).
--
Arvid Norberg
--
Arvid Norberg
Michael Mckeown
2016-05-11 14:53:36 UTC
Permalink
Hi there, the patch does not solve the problem on my end, building:

toolset=msvc-14.0

boost-link=static

runtime-link=static

deprecated-functions=off

encryption=on

link=static dht=on

logging=off

i2p=on

variant=release


Thanks.
Post by Arvid Norberg
Please give this patch a try: https://github.com/arvidn/libtorrent/pull/720
Post by Michael Mckeown
On Mon, May 9, 2016 at 10:45 AM, Michael Mckeown <
Post by Michael Mckeown
dht.dht_nodes always returns 0.
I believe I have things set up correctly as a trackerless torrent will
std::vector<stats_metric> map = session_stats_metrics ( );
for ( std::vector<stats_metric>::const_iterator i = map.begin ( );
i != map.end ( ); ++i )
{
if ( i->name == "dht.dht_nodes" )
This comparison looks suspicious. Are you sure this isn't a pointer
comparison?
Post by Michael Mckeown
{
statistics.dht_nodes = i->value_index;
}
}
[...]
that's how I'm doing things,
peer.num_peers_connected/net.sent_payload_bytes/net.recv_payload_bytes/net.has_incoming_connections
work as expected via the above method.
Any pointers on how to fix this?
It looks like there's a bug in libtorrent where some DHT counters are not
updated. I'll fix this in RC_1_1 (for the next 1.1 release).
--
Arvid Norberg
metamystical
2016-06-14 14:52:06 UTC
Permalink
Post by Michael Mckeown
Any pointers on how to fix this?
This was fixed a week ago in this pull request, now merged into the master
branch on github:

https://github.com/arvidn/libtorrent/pull/783

Loading...