Discussion:
[libtorrent] settings_pack::dht_bootstrap_node
Michael Mckeown
2016-08-22 07:49:23 UTC
Permalink
settings_pack::dht_bootstrap_node is not a member of settings pack.
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 == "peer.num_peers_connected" )
{
statistics.num_peers_connected = i->value_index;
#ifdef DEBUG_CONSOLE
std::cout << "Map: " << i->name << " " << i->value_index
<< "\n";
#endif
}
if ( i->name == "dht.dht_nodes" )
{
statistics.dht_nodes = i->value_index;
#ifdef DEBUG_CONSOLE
std::cout << "Map: " << i->name << " " << i->value_index
<< "\n";
#endif
}
if ( i->name == "dht.dht_peers" )
{
statistics.dht_peers = i->value_index;
#ifdef DEBUG_CONSOLE
std::cout << "Map: " << i->name << " " << i->value_index
<< "\n";
#endif
}
if ( i->name == "net.sent_payload_bytes" )
{
statistics.sent_payload_bytes = i->value_index;
#ifdef DEBUG_CONSOLE
std::cout << "Map: " << i->name << " " << i->value_index
<< "\n";
#endif
}
if ( i->name == "net.recv_payload_bytes" )
{
statistics.recv_payload_bytes = i->value_index;
#ifdef DEBUG_CONSOLE
std::cout << "Map: " << i->name << " " << i->value_index
<< "\n";
#endif
}
if ( i->name == "net.has_incoming_connections" )
{
statistics.has_incoming_connections = i->value_index;
#ifdef DEBUG_CONSOLE
std::cout << "Map: " << i->name << " " << i->value_index
<< "\n";
#endif
}
}
after dht.dht_peers is in the loop libtorrent just hangs and remains
frozen till the process is manually terminated.

------------------------------------------------------------------------------
Michael Mckeown
2016-08-22 08:12:06 UTC
Permalink
dht_bootstrap_nodes not dht_bootstrap_node as per the changelog, still get the hanging issue though.

On 22/08/2016 08:49, Michael Mckeown wrote:

settings_pack::dht_bootstrap_node is not a member of settings pack.

also when running this latest master:



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 == "peer.num_peers_connected" )
{
statistics.num_peers_connected = i->value_index;
#ifdef DEBUG_CONSOLE
std::cout << "Map: " << i->name << " " << i->value_index
<< "\n";
#endif
}
if ( i->name == "dht.dht_nodes" )
{
statistics.dht_nodes = i->value_index;
#ifdef DEBUG_CONSOLE
std::cout << "Map: " << i->name << " " << i->value_index
<< "\n";
#endif
}
if ( i->name == "dht.dht_peers" )
{
statistics.dht_peers = i->value_index;
#ifdef DEBUG_CONSOLE
std::cout << "Map: " << i->name << " " << i->value_index
<< "\n";
#endif
}
if ( i->name == "net.sent_payload_bytes" )
{
statistics.sent_payload_bytes = i->value_index;
#ifdef DEBUG_CONSOLE
std::cout << "Map: " << i->name << " " << i->value_index
<< "\n";
#endif
}
if ( i->name == "net.recv_payload_bytes" )
{
statistics.recv_payload_bytes = i->value_index;
#ifdef DEBUG_CONSOLE
std::cout << "Map: " << i->name << " " << i->value_index
<< "\n";
#endif
}
if ( i->name == "net.has_incoming_connections" )
{
statistics.has_incoming_connections = i->value_index;
#ifdef DEBUG_CONSOLE
std::cout << "Map: " << i->name << " " << i->value_index
<< "\n";
#endif
}
}



after dht.dht_peers is in the loop libtorrent just hangs and remains
frozen till the process is manually terminated.
Arvid Norberg
2016-08-22 21:10:40 UTC
Permalink
where does it hang?

I cannot reproduce it. I assume you meant to perform string comparisons,
not char* comparisons (which most likely will be false unconditionally).
Post by Michael Mckeown
dht_bootstrap_nodes not dht_bootstrap_node as per the changelog, still get
the hanging issue though.
settings_pack::dht_bootstrap_node is not a member of settings pack.
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 == "peer.num_peers_connected" )
{
statistics.num_peers_connected = i->value_index;
#ifdef DEBUG_CONSOLE
std::cout << "Map: " << i->name << " " << i->value_index
<< "\n";
#endif
}
if ( i->name == "dht.dht_nodes" )
{
statistics.dht_nodes = i->value_index;
#ifdef DEBUG_CONSOLE
std::cout << "Map: " << i->name << " " << i->value_index
<< "\n";
#endif
}
if ( i->name == "dht.dht_peers" )
{
statistics.dht_peers = i->value_index;
#ifdef DEBUG_CONSOLE
std::cout << "Map: " << i->name << " " << i->value_index
<< "\n";
#endif
}
if ( i->name == "net.sent_payload_bytes" )
{
statistics.sent_payload_bytes = i->value_index;
#ifdef DEBUG_CONSOLE
std::cout << "Map: " << i->name << " " << i->value_index
<< "\n";
#endif
}
if ( i->name == "net.recv_payload_bytes" )
{
statistics.recv_payload_bytes = i->value_index;
#ifdef DEBUG_CONSOLE
std::cout << "Map: " << i->name << " " << i->value_index
<< "\n";
#endif
}
if ( i->name == "net.has_incoming_connections" )
{
statistics.has_incoming_connections = i->value_index;
#ifdef DEBUG_CONSOLE
std::cout << "Map: " << i->name << " " << i->value_index
<< "\n";
#endif
}
}
after dht.dht_peers is in the loop libtorrent just hangs and remains
frozen till the process is manually terminated.
------------------------------------------------------------
------------------
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
--
Arvid Norberg
------------------------------------------------------------------------------
Michael Mckeown
2016-08-22 23:21:04 UTC
Permalink
Hi there,
libtorrent::session *Session;
bool start_client_session ( )
{
Session = new libtorrent::session;
libtorrent::settings_pack pack;
session Session ( pack );
error_code ec;
if ( ec )
{
return false;
}
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 == "peer.num_peers_connected" )
{
after few tries at this it appears the for loop will sometimes begin
while other times not but it never completes and it looks like
'session Client_Session ( pack );' is where the hanging begins.

Roll back to yesterdays master and all is fine.

No crash so I get no debug info.

Thanks.
where does it hang?
I cannot reproduce it. I assume you meant to perform string comparisons,
not char* comparisons (which most likely will be false unconditionally).
Post by Michael Mckeown
dht_bootstrap_nodes not dht_bootstrap_node as per the changelog, still get
the hanging issue though.
settings_pack::dht_bootstrap_node is not a member of settings pack.
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 == "peer.num_peers_connected" )
{
statistics.num_peers_connected = i->value_index;
#ifdef DEBUG_CONSOLE
std::cout << "Map: " << i->name << " " << i->value_index
<< "\n";
#endif
}
if ( i->name == "dht.dht_nodes" )
{
statistics.dht_nodes = i->value_index;
#ifdef DEBUG_CONSOLE
std::cout << "Map: " << i->name << " " << i->value_index
<< "\n";
#endif
}
if ( i->name == "dht.dht_peers" )
{
statistics.dht_peers = i->value_index;
#ifdef DEBUG_CONSOLE
std::cout << "Map: " << i->name << " " << i->value_index
<< "\n";
#endif
}
if ( i->name == "net.sent_payload_bytes" )
{
statistics.sent_payload_bytes = i->value_index;
#ifdef DEBUG_CONSOLE
std::cout << "Map: " << i->name << " " << i->value_index
<< "\n";
#endif
}
if ( i->name == "net.recv_payload_bytes" )
{
statistics.recv_payload_bytes = i->value_index;
#ifdef DEBUG_CONSOLE
std::cout << "Map: " << i->name << " " << i->value_index
<< "\n";
#endif
}
if ( i->name == "net.has_incoming_connections" )
{
statistics.has_incoming_connections = i->value_index;
#ifdef DEBUG_CONSOLE
std::cout << "Map: " << i->name << " " << i->value_index
<< "\n";
#endif
}
}
after dht.dht_peers is in the loop libtorrent just hangs and remains
frozen till the process is manually terminated.
------------------------------------------------------------
------------------
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------------------------
Arvid Norberg
2016-08-23 01:12:22 UTC
Permalink
Post by Michael Mckeown
Hi there,
libtorrent::session *Session;
bool start_client_session ( )
{
Session = new libtorrent::session;
libtorrent::settings_pack pack;
session Session ( pack );
error_code ec;
if ( ec )
{
return false;
}
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 == "peer.num_peers_connected" )
{
after few tries at this it appears the for loop will sometimes begin
while other times not but it never completes and it looks like
'session Client_Session ( pack );' is where the hanging begins.
I take it this is C++, right? It's not clear to me what the intention of
this code is. You create a heap allocated session object, that you don't
initialize with a settings pack. Then you create another session on the
stack, which you do initialize, but with a default constructed
settings_pack. You're saying the constructor of the second session appears
to hang?

Or actually, "session" is not namespace qualified, so is that a different
type than libtorrent::session?

Roll back to yesterdays master and all is fine.
You're rebuilding your client too, right? master does not provide a stable
ABI.
Post by Michael Mckeown
No crash so I get no debug info.
you could break into the debugger and look at the callstacks of the
threads. Presumably the main thread is waiting for something.
--
Arvid Norberg
------------------------------------------------------------------------------
Michael Mckeown
2016-08-24 13:04:44 UTC
Permalink
Hi again,

I was going through the various master versions since the last stable
release as file_completed_alert is never posted but there was another
post about this with a patch although the patch does not work with any
of the masters since last stable.

Anyhow my setup is taken from a post you helped me with on
StackOverflow, basically Session is used across various .cpp files and:

libtorrent::session *Session;

is when start_client_session ( ) is called the reference to the only
bool is_DHT_running ( )
{
return Session->is_dht_running ( );
}
the only change to the way the session operates is the addition of
settings_pack::dht_bootstrap_node, I'm looking in to the debugger now.


Thanks.
Post by Michael Mckeown
Hi there,
libtorrent::session *Session;
bool start_client_session ( )
{
Session = new libtorrent::session;
libtorrent::settings_pack pack;
session Session ( pack );
error_code ec;
if ( ec )
{
return false;
}
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 == "peer.num_peers_connected" )
{
after few tries at this it appears the for loop will sometimes begin
while other times not but it never completes and it looks like
'session Client_Session ( pack );' is where the hanging begins.
I take it this is C++, right? It's not clear to me what the intention of
this code is. You create a heap allocated session object, that you don't
initialize with a settings pack. Then you create another session on the
stack, which you do initialize, but with a default constructed
settings_pack. You're saying the constructor of the second session appears
to hang?
Or actually, "session" is not namespace qualified, so is that a different
type than libtorrent::session?
Roll back to yesterdays master and all is fine.
You're rebuilding your client too, right? master does not provide a stable
ABI.
Post by Michael Mckeown
No crash so I get no debug info.
you could break into the debugger and look at the callstacks of the
threads. Presumably the main thread is waiting for something.
------------------------------------------------------------------------------
Loading...