Libtorrent: I2P support

Created on 15 Nov 2017  路  22Comments  路  Source: arvidn/libtorrent

libtorrent version: 1.1.1.0
platform/architecture: Ubuntu 17.10

Hey, i am just curious what is the status of the I2P support. The documentation about this feature is a little bit light right now. In particular i am not sure where i do mistake in the following python code:

import libtorrent as lt
session = lt.session(flags=0)
h = session.add_torrent({'ti': lt.torrent_info('/tmp/Downloads/test.torrent'), 'save_path': '/tmp/Downloads'})

session.listen_on(6881, 6881)

proxy_settings = lt.proxy_settings()
proxy_settings.hostname = '127.0.0.1'
proxy_settings.port = 7656
session.set_i2p_proxy(proxy_settings)

The program doesnot download anything and cannot find peers(the i2pshark do it very fast). Please help me to figure out what is going on. Am i right that libtorrent use SAM interface, so i should use port 7656?

bug

Most helpful comment

I would love to see libtorrent get fuller support for i2p, if possible. And, further, it would be nice if some standard could be drawn up to help humans know whether torrents are bridged between i2p and clearnet. For example, trackers might support a flag to indicate whether they have peers on either network, and a DHT node might return a flag to show they're bridging i2p and clearnet also. That might allow clearnet torrent trackers to start marking torrents as being "darknet enabled", helping to encourage more secure and private torrenting.

All 22 comments

Yes, libtorrent use the SAM protocol. The main problem with libtorrent's i2p support is that it does not have any regression tests, so it's possible that it has broken at some point.

Do you have a log of the alerts you get? please enable all alerts in the alert_mask in the settings_pack.

As you suggested i added to the code

session.set_alert_mask(lt.alert.category_t.all_categories)
and

in the end
time.sleep(4)
alerts = session.pop_alerts()
for alert in alerts:
print(type(alert).__name__, alert.message())

And get the following:

add_torrent_alert added torrent: test
listen_succeeded_alert successfully listening on [TCP] [::]:6861
listen_succeeded_alert successfully listening on [TCP] 0.0.0.0:6861
listen_succeeded_alert successfully listening on [UDP] 0.0.0.0:6861
state_changed_alert : state changed to: downloading
torrent_checked_alert checked

Everything looks fine for me.

The torrent is from tracker2.postman.i2p. I read that previously the tracker was not supported by the libtorrent, because the program did not support base32 names. Am i correct that now base32 names are supproted?

there must be more alerts than that, right? things like announces to the trackers for instance.

Indeed, it is strange. i do not see any other alerts

oh, you're probably setting the mask after everything already happened. set the mask as part of the settings_pack and pass that into the session constructor

Ok, i put session = lt.session(alert_mask=lt.alert.category_t.all_categories,flags=0)
and get that the host not found. The full alert is

listen_succeeded_alert successfully listening on [TCP] [::]:6881
listen_succeeded_alert successfully listening on [TCP] 0.0.0.0:6881
listen_succeeded_alert successfully listening on [UDP] 0.0.0.0:6881
add_torrent_alert added torrent: test
torrent_added_alert added
state_changed_alert : state changed to: downloading
torrent_checked_alert checked
torrent_resumed_alert resumed
tracker_announce_alert (http://tracker2.postman.i2p/announce.php) sending announce (started)
stats_alert : [1000] 0 0 0 0 0 0 0 0 0 0
tracker_error_alert (http://tracker2.postman.i2p/announce.php) (-1) Host not found (authoritative) "" (1)
tracker_announce_alert (http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a) sending announce (started)
tracker_error_alert (http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a) (-1) Host not found (authoritative) "" (1)
stats_alert : [1000] 0 0 0 0 0 0 0 0 0 0
stats_alert : [1000] 0 0 0 0 0 0 0 0 0 0
stats_alert : [1000] 0 0 0 0 0 0 0 0 0 0
stats_alert : [1000] 0 0 0 0 0 0 0 0 0 0
stats_alert : [1000] 0 0 0 0 0 0 0 0 0 0
stats_alert : [1000] 0 0 0 0 0 0 0 0 0 0
stats_alert : [1000] 0 0 0 0 0 0 0 0 0 0
stats_alert : [1000] 0 0 0 0 0 0 0 0 0 0
stats_alert : [1000] 0 0 0 0 0 0 0 0 0 0
listen_succeeded_alert successfully listening on [TCP] [::]:6861
listen_succeeded_alert successfully listening on [TCP] 0.0.0.0:6861
listen_succeeded_alert successfully listening on [UDP] 0.0.0.0:6861
stats_alert : [1000] 0 0 0 0 0 0 0 0 0 0
stats_alert : [1000] 0 0 0 0 0 0 0 0 0 0
stats_alert : [1000] 0 0 0 0 0 0 0 0 0 0
stats_alert : [1000] 0 0 0 0 0 0 0 0 0 0

after few seconds in the end i get Segmentation fault (core dumped)

The program looks like this:

import libtorrent as lt
import time

session = lt.session(alert_mask=lt.alert.category_t.all_categories,flags=0)
print('Session started: ', lt.version)

h = session.add_torrent({'ti': lt.torrent_info('/tmp/Downloads/test.torrent'), 'save_path': '/tmp/Downloads/'})

h.auto_managed(False)

session.listen_on(6861, 6861)
proxy_settings = lt.proxy_settings()
proxy_settings.type=lt.proxy_type.i2p_proxy
proxy_settings.hostname = '127.0.0.1'
proxy_settings.port = 7656
session.set_i2p_proxy(proxy_settings)
s = h.status()
s.num_peers
time.sleep(4)
alerts = session.pop_alerts()
for alert in alerts:
print(type(alert).__name__, alert.message())

Without h.auto_managed(False) i get the alerts above but the program crashes.

With h.auto_managed(False) the program doesnot crash and i get only this:

listen_succeeded_alert successfully listening on [TCP] [::]:6881
listen_succeeded_alert successfully listening on [TCP] 0.0.0.0:6881
listen_succeeded_alert successfully listening on [UDP] 0.0.0.0:6881
add_torrent_alert added torrent: test
torrent_added_alert added
listen_succeeded_alert successfully listening on [TCP] [::]:6861
listen_succeeded_alert successfully listening on [TCP] 0.0.0.0:6861
listen_succeeded_alert successfully listening on [UDP] 0.0.0.0:6861
state_changed_alert : state changed to: downloading
torrent_checked_alert checked

I am still trying to find my mistake. I rewrote c++

```int main(int argc, char* argv[])
{
using namespace libtorrent;
namespace lt = libtorrent;

settings_pack sett;
sett.set_str(settings_pack::listen_interfaces, "0.0.0.0:6881");
sett.set_int(settings_pack::proxy_type, settings_pack::i2p_proxy);
sett.set_int(settings_pack::i2p_port, 7656);
sett.set_str(settings_pack::i2p_hostname, "0.0.0.0");
sett.set_bool(settings_pack::force_proxy, true);
sett.set_bool(settings_pack::enable_upnp, false);
sett.set_bool(settings_pack::enable_natpmp, false);
sett.set_bool(settings_pack::enable_dht, false);

lt::session s(sett);
s.set_alert_mask(lt::alert::all_categories);
std::vector alerts;
add_torrent_params p;
p.save_path = "./";
error_code ec;
p.ti = boost::make_shared(std::string(argv[1]), boost::ref(ec), 0);
if (ec)
{
fprintf(stderr, "%s\n", ec.message().c_str());
return 1;
}
s.add_torrent(p, ec);
if (ec)
{
fprintf(stderr, "%s\n", ec.message().c_str());
return 1;
}

usleep(60000000);
s.pop_alerts(&alerts);
for(libtorrent::alert const *a : alerts) {
std::cout << a->message();
printf("\n");
}
```
In the result i get

successfully listening on [TCP] [::]:6881
successfully listening on [TCP] 0.0.0.0:6881
successfully listening on [UDP] 0.0.0.0:6881
added torrent: test
added
: state changed to: downloading
checked
resumed
(http://tracker2.postman.i2p/announce.php) sending announce (started)
: [1400] 0 0 0 0 0 0 0 0 0 0
(http://tracker2.postman.i2p/announce.php) (-1) "Waiting for i2p acceptor from SAM bridge" (1)
(http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a) sending announce (started)
(http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a) (-1) "Waiting for i2p acceptor from SAM bridge" (1)
: [1000] 0 0 0 0 0 0 0 0 0 0
: [1000] 0 0 0 0 0 0 0 0 0 0
: [1000] 0 0 0 0 0 0 0 0 0 0
: [1000] 0 0 0 0 0 0 0 0 0 0
incoming connection from SOME IP (TCP)
: [1000] 0 0 0 0 0 0 0 0 0 0
: [1000] 0 0 0 0 0 0 0 0 0 0
: [1000] 0 0 0 0 0 0 0 0 0 0
: [1000] 0 0 0 0 0 0 0 0 0 0
: [1000] 0 0 0 0 0 0 0 0 0 0
: [1000] 0 0 0 0 0 0 0 0 0 0
: [1000] 0 0 0 0 0 0 0 0 0 0
: [1000] 0 0 0 0 0 0 0 0 0 0
: [1000] 0 0 0 0 0 0 0 0 0 0
: [1000] 0 0 0 0 0 0 0 0 0 0
: [1000] 0 0 0 0 0 0 0 0 0 0
: [1000] 0 0 0 0 0 0 0 0 0 0
(http://tracker2.postman.i2p/announce.php) sending announce (started)
(http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a) sending announce (started)
(http://tracker2.postman.i2p/announce.php) (-1) "Waiting for i2p acceptor from SAM bridge" (2)
(http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a) (-1) "Waiting for i2p acceptor from SAM bridge" (2)
: [1000] 0 0 0 0 0 0 0 0 0 0
: [1000] 0 0 0 0 0 0 0 0 0 0
: [1000] 0 0 0 0 0 0 0 0 0 0
: [1000] 0 0 0 0 0 0 0 0 0 0
: [1000] 0 0 0 0 0 0 0 0 0 0
: [1000] 0 0 0 0 0 0 0 0 0 0
incoming connection from SOME IP (TCP)
: [1000] 0 0 0 0 0 0 0 0 0 0
: [1000] 0 0 0 0 0 0 0 0 0 0
: [1000] 0 0 0 0 0 0 0 0 0 0
Segmentation fault (core dumped)

Ok, i build libtorrent with the debug option. It seems it is some kind of bug in the libtorrent. gdb shows the following

Starting program: /home/reich/TEMP/torrents/i2p_torrents /tmp/Downloads/test.torrent
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff5d6f700 (LWP 21680)]
[New Thread 0x7ffff556e700 (LWP 21681)]
[New Thread 0x7ffff4d6d700 (LWP 21682)]
[New Thread 0x7fffeffff700 (LWP 21683)]
[New Thread 0x7fffef7fe700 (LWP 21684)]
[New Thread 0x7fffeeffd700 (LWP 21685)]
start session
config: ipv6_deprecated_ version: 1.1.5.0 revision: 37ffe99a1
max connections: 200
max files: 1024
generated peer ID:
*** session thread init
session stats header: peer.error_peers, peer.disconnected_peers, peer.eof_peers, peer.connreset_peers, peer.connrefused_peers, peer.connaborted_peers, peer.notconnected_peers, peer.perm_peers, peer.buffer_peers, peer.unreachable_peers, peer.broken_pipe_peers, peer.addrinuse_peers, peer.no_access_peers, peer.invalid_arg_peers, peer.aborted_peers, peer.piece_requests, peer.max_piece_requests, peer.invalid_piece_requests, peer.choked_piece_requests, peer.cancelled_piece_requests, peer.piece_rejects, peer.error_incoming_peers, peer.error_outgoing_peers, peer.error_rc4_peers, peer.error_encrypted_peers, peer.error_tcp_peers, peer.error_utp_peers, picker.reject_piece_picks, picker.unchoke_piece_picks, picker.incoming_redundant_piece_picks, picker.incoming_piece_picks, picker.end_game_piece_picks, picker.snubbed_piece_picks, picker.interesting_piece_picks, picker.hash_fail_piece_picks, picker.piece_picker_partial_loops, picker.piece_picker_suggest_loops, picker.piece_picker_sequential_loops, picker.piece_picker_reverse_rare_loops, picker.piece_picker_rare_loops, picker.piece_picker_rand_start_loops, picker.piece_picker_rand_loops, picker.piece_picker_busy_loops, peer.connect_timeouts, peer.uninteresting_peers, peer.timeout_peers, peer.no_memory_peers, peer.too_many_peers, peer.transport_timeout_peers, peer.num_banned_peers, peer.banned_for_hash_failure, peer.connection_attempts, peer.connection_attempt_loops, peer.incoming_connections, net.on_read_counter, net.on_write_counter, net.on_tick_counter, net.on_lsd_counter, net.on_lsd_peer_counter, net.on_udp_counter, net.on_accept_counter, net.on_disk_queue_counter, net.on_disk_counter, ses.torrent_evicted_counter, ses.num_incoming_choke, ses.num_incoming_unchoke, ses.num_incoming_interested, ses.num_incoming_not_interested, ses.num_incoming_have, ses.num_incoming_bitfield, ses.num_incoming_request, ses.num_incoming_piece, ses.num_incoming_cancel, ses.num_incoming_dht_port, ses.num_incoming_suggest, ses.num_incoming_have_all, ses.num_incoming_have_none, ses.num_incoming_reject, ses.num_incoming_allowed_fast, ses.num_incoming_ext_handshake, ses.num_incoming_pex, ses.num_incoming_metadata, ses.num_incoming_extended, ses.num_outgoing_choke, ses.num_outgoing_unchoke, ses.num_outgoing_interested, ses.num_outgoing_not_interested, ses.num_outgoing_have, ses.num_outgoing_bitfield, ses.num_outgoing_request, ses.num_outgoing_piece, ses.num_outgoing_cancel, ses.num_outgoing_dht_port, ses.num_outgoing_suggest, ses.num_outgoing_have_all, ses.num_outgoing_have_none, ses.num_outgoing_reject, ses.num_outgoing_allowed_fast, ses.num_outgoing_ext_handshake, ses.num_outgoing_pex, ses.num_outgoing_metadata, ses.num_outgoing_extended, ses.num_piece_passed, ses.num_piece_failed, ses.num_have_pieces, ses.num_total_pieces_added, disk.num_blocks_written, disk.num_blocks_read, disk.num_blocks_hashed, disk.num_blocks_cache_hits, disk.num_write_ops, disk.num_read_ops, disk.num_read_back, disk.disk_read_time, disk.disk_write_time, disk.disk_hash_time, disk.disk_job_time, ses.waste_piece_timed_out, ses.waste_piece_cancelled, ses.waste_piece_unknown, ses.waste_piece_seed, ses.waste_piece_end_game, ses.waste_piece_closing, net.sent_payload_bytes, net.sent_bytes, net.sent_ip_overhead_bytes, net.sent_tracker_bytes, net.recv_payload_bytes, net.recv_bytes, net.recv_ip_overhead_bytes, net.recv_tracker_bytes, net.recv_failed_bytes, net.recv_redundant_bytes, dht.dht_messages_in, dht.dht_messages_out, dht.dht_messages_out_dropped, dht.dht_bytes_in, dht.dht_bytes_out, dht.dht_ping_in, dht.dht_ping_out, dht.dht_find_node_in, dht.dht_find_node_out, dht.dht_get_peers_in, dht.dht_get_peers_out, dht.dht_announce_peer_in, dht.dht_announce_peer_out, dht.dht_get_in, dht.dht_get_out, dht.dht_put_in, dht.dht_put_out, dht.dht_invalid_announce, dht.dht_invalid_get_peers, dht.dht_invalid_put, dht.dht_invalid_get, utp.utp_packet_loss, utp.utp_timeout, utp.utp_packets_in, utp.utp_packets_out, utp.utp_fast_retransmit, utp.utp_packet_resend, utp.utp_samples_above_target, utp.utp_samples_below_target, utp.utp_payload_pkts_in, utp.utp_payload_pkts_out, utp.utp_invalid_pkts_in, utp.utp_redundant_pkts_in, sock_bufs.socket_send_size3, sock_bufs.socket_send_size4, sock_bufs.socket_send_size5, sock_bufs.socket_send_size6, sock_bufs.socket_send_size7, sock_bufs.socket_send_size8, sock_bufs.socket_send_size9, sock_bufs.socket_send_size10, sock_bufs.socket_send_size11, sock_bufs.socket_send_size12, sock_bufs.socket_send_size13, sock_bufs.socket_send_size14, sock_bufs.socket_send_size15, sock_bufs.socket_send_size16, sock_bufs.socket_send_size17, sock_bufs.socket_send_size18, sock_bufs.socket_send_size19, sock_bufs.socket_send_size20, sock_bufs.socket_recv_size3, sock_bufs.socket_recv_size4, sock_bufs.socket_recv_size5, sock_bufs.socket_recv_size6, sock_bufs.socket_recv_size7, sock_bufs.socket_recv_size8, sock_bufs.socket_recv_size9, sock_bufs.socket_recv_size10, sock_bufs.socket_recv_size11, sock_bufs.socket_recv_size12, sock_bufs.socket_recv_size13, sock_bufs.socket_recv_size14, sock_bufs.socket_recv_size15, sock_bufs.socket_recv_size16, sock_bufs.socket_recv_size17, sock_bufs.socket_recv_size18, sock_bufs.socket_recv_size19, sock_bufs.socket_recv_size20, ses.num_checking_torrents, ses.num_stopped_torrents, ses.num_upload_only_torrents, ses.num_downloading_torrents, ses.num_seeding_torrents, ses.num_queued_seeding_torrents, ses.num_queued_download_torrents, ses.num_error_torrents, ses.non_filter_torrents, ses.num_loaded_torrents, ses.num_pinned_torrents, peer.num_tcp_peers, peer.num_socks5_peers, peer.num_http_proxy_peers, peer.num_utp_peers, peer.num_i2p_peers, peer.num_ssl_peers, peer.num_ssl_socks5_peers, peer.num_ssl_http_proxy_peers, peer.num_ssl_utp_peers, peer.num_peers_half_open, peer.num_peers_connected, peer.num_peers_up_interested, peer.num_peers_down_interested, peer.num_peers_up_unchoked_all, peer.num_peers_up_unchoked_optimistic, peer.num_peers_up_unchoked, peer.num_peers_down_unchoked, peer.num_peers_up_requests, peer.num_peers_down_requests, peer.num_peers_up_disk, peer.num_peers_down_disk, peer.num_peers_end_game, disk.write_cache_blocks, disk.read_cache_blocks, disk.request_latency, disk.pinned_blocks, disk.disk_blocks_in_use, disk.queued_disk_jobs, disk.num_running_disk_jobs, disk.num_read_jobs, disk.num_write_jobs, disk.num_jobs, disk.num_writing_threads, disk.num_running_threads, disk.blocked_disk_jobs, disk.queued_write_bytes, ses.num_unchoke_slots, disk.num_fenced_read, disk.num_fenced_write, disk.num_fenced_hash, disk.num_fenced_move_storage, disk.num_fenced_release_files, disk.num_fenced_delete_files, disk.num_fenced_check_fastresume, disk.num_fenced_save_resume_data, disk.num_fenced_rename_file, disk.num_fenced_stop_torrent, disk.num_fenced_cache_piece, disk.num_fenced_flush_piece, disk.num_fenced_flush_hashed, disk.num_fenced_flush_storage, disk.num_fenced_trim_cache, disk.num_fenced_file_priority, disk.num_fenced_load_torrent, disk.num_fenced_clear_piece, disk.num_fenced_tick_storage, disk.arc_mru_size, disk.arc_mru_ghost_size, disk.arc_mfu_size, disk.arc_mfu_ghost_size, disk.arc_write_size, disk.arc_volatile_size, dht.dht_nodes, dht.dht_node_cache, dht.dht_torrents, dht.dht_peers, dht.dht_immutable_data, dht.dht_mutable_data, dht.dht_allocated_observers, net.has_incoming_connections, net.limiter_up_queue, net.limiter_down_queue, net.limiter_up_bytes, net.limiter_down_bytes, utp.num_utp_idle, utp.num_utp_syn_sent, utp.num_utp_connected, utp.num_utp_fin_sent, utp.num_utp_close_wait, utp.num_utp_deleted
not starting DHT announce timer: m_dht == NULL
done starting session
update listen interfaces: 0.0.0.0:6881
open listen port
listening on: [::]:6881 external port: 6881
listening on: 0.0.0.0:6881 external port: 6881
successfully listening on [TCP] [::]:6881
successfully listening on [TCP] 0.0.0.0:6881
successfully listening on [UDP] 0.0.0.0:6881
>>> SET_TOS [ udp_socket tos: 20 e: Bad file descriptor ]
added torrent: Test.Torrent
Test.Torrent added
Test.Torrent: creating torrent: Test.Torrent max-uploads: -1 max-connections: -1 upload-limit: -1 download-limit: -1 flags: apply-ip-filter paused auto-managed update-subscribe save-path: /tmp/Downloads/
Test.Torrent: *** set-max-uploads: 16777215
Test.Torrent: *** set-max-connections: 16777215
Test.Torrent: *** UPDATE LIST [ torrent_want_scrape : 1 ]
Test.Torrent: init torrent: Test.Torrent
Test.Torrent: init, async_check_fastresume
Test.Torrent: fastresume data accepted
Test.Torrent: state changed to: downloading
Test.Torrent: set_state() 3
Test.Torrent: *** UPDATE LIST [ torrent_downloading_auto_managed : 1 ]
Test.Torrent checked
Test.Torrent: start_announcing(), paused
Test.Torrent: auto manager starting torrent
Test.Torrent: *** UPDATE LIST [ torrent_want_scrape : 0 ]
Test.Torrent resumed
Test.Torrent: *** UPDATE LIST [ torrent_want_tick : 1 ]
Test.Torrent: *** tracker: "http://tracker2.postman.i2p/announce.php" [ tiers: 0 trackers: 0 i->tier: 0 tier: 2147483647 working: 1 fails: 0 limit: 0 upd: 0 can: 1 sent: 0 ]
Test.Torrent: ==> TRACKER REQUEST "http://tracker2.postman.i2p/announce.php" event: started abort: 0 
Test.Torrent (http://tracker2.postman.i2p/announce.php) sending announce (started)
Test.Torrent: *** tracker: "http://tracker2.postman.i2p/announce.php" [ tiers: 0 trackers: 0 found: 0 i->tier: 0 tier: 2147483647 working: 1 fails: 0 limit: 0 upd: 1 ]
Test.Torrent: *** update tracker timer: next_announce < now 0 m_waiting_tracker: 0 next_announce_in: 877468233
Test.Torrent: [1402] 0 0 0 0 0 0 0 0 0 0
Test.Torrent: *** tracker error: (161)  Waiting for i2p acceptor from SAM bridge
Test.Torrent: *** increment tracker fail count [1]
Test.Torrent (http://tracker2.postman.i2p/announce.php) (-1)  "Waiting for i2p acceptor from SAM bridge" (1)
Test.Torrent: *** tracker: "http://tracker2.postman.i2p/announce.php" [ tiers: 0 trackers: 0 i->tier: 0 tier: 2147483647 working: 0 fails: 1 limit: 0 upd: 0 can: 0 sent: 0 ]
Test.Torrent: *** tracker: "http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a" [ tiers: 0 trackers: 0 i->tier: 1 tier: 2147483647 working: 1 fails: 0 limit: 0 upd: 0 can: 1 sent: 0 ]
Test.Torrent: ==> TRACKER REQUEST "http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a" event: started abort: 0
Test.Torrent (http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a) sending announce (started)
Test.Torrent: *** tracker: "http://tracker2.postman.i2p/announce.php" [ tiers: 0 trackers: 0 found: 0 i->tier: 0 tier: 2147483647 working: 0 fails: 1 limit: 0 upd: 0 ]
Test.Torrent: *** tracker: "http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a" [ tiers: 0 trackers: 0 found: 0 i->tier: 1 tier: 2147483647 working: 1 fails: 0 limit: 0 upd: 1 ]
Test.Torrent: *** update tracker timer: next_announce < now 0 m_waiting_tracker: 1 next_announce_in: -16
Test.Torrent: *** tracker: "http://tracker2.postman.i2p/announce.php" [ tiers: 0 trackers: 0 found: 0 i->tier: 0 tier: 2147483647 working: 0 fails: 1 limit: 0 upd: 0 ]
Test.Torrent: *** tracker: "http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a" 
[ tiers: 0 trackers: 0 found: 0 i->tier: 1 tier: 2147483647 working: 1 fails: 0 limit: 0 upd: 1 ]
Test.Torrent: *** update tracker timer: next_announce < now 0 m_waiting_tracker: 1 next_announce_in: -16
Test.Torrent: *** tracker: "http://tracker2.postman.i2p/announce.php" [ tiers: 0 trackers: 0 found: 0 i->tier: 0 tier: 2147483647 working: 0 fails: 1 limit: 0 upd: 0 ]
Test.Torrent: *** tracker: "http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a" [ tiers: 0 trackers: 0 found: 0 i->tier: 1 tier: 2147483647 working: 1 fails: 0 limit: 0 upd: 1 ]
Test.Torrent: *** update tracker timer: next_announce < now 0 m_waiting_tracker: 1 next_announce_in: -17
Test.Torrent: *** tracker error: (161)  Waiting for i2p acceptor from SAM bridge
Test.Torrent: *** increment tracker fail count [1]
Test.Torrent (http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a) (-1)  "Waiting for i2p acceptor from SAM bridge" (1)
Test.Torrent: *** tracker: "http://tracker2.postman.i2p/announce.php" [ tiers: 0 trackers: 0 i->tier: 0 tier: 2147483647 working: 0 fails: 1 limit: 0 upd: 0 can: 0 sent: 0 ]
Test.Torrent: *** tracker: "http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a" [ tiers: 0 trackers: 0 i->tier: 1 tier: 2147483647 working: 0 fails: 1 limit: 0 upd: 0 can: 0 sent: 0 ]
Test.Torrent: *** tracker: "http://tracker2.postman.i2p/announce.php" [ tiers: 0 trackers: 0 found: 0 i->tier: 0 tier: 2147483647 working: 0 fails: 1 limit: 0 upd: 0 ]
Test.Torrent: *** tracker: "http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a" [ tiers: 0 trackers: 0 found: 0 i->tier: 1 tier: 2147483647 working: 0 fails: 1 limit: 0 upd: 0 ]
Test.Torrent: *** update tracker timer: next_announce < now 0 m_waiting_tracker: 1 next_announce_in: -16
Test.Torrent: *** tracker: "http://tracker2.postman.i2p/announce.php" [ tiers: 0 trackers: 0 found: 0 i->tier: 0 tier: 2147483647 working: 0 fails: 1 limit: 0 upd: 0 ]
Test.Torrent: *** tracker: "http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a" [ tiers: 0 trackers: 0 found: 0 i->tier: 1 tier: 2147483647 working: 0 fails: 1 limit: 0 upd: 0 ]
Test.Torrent: *** update tracker timer: next_announce < now 0 m_waiting_tracker: 1 next_announce_in: -17
Test.Torrent: [1000] 0 0 0 0 0 0 0 0 0 0
Test.Torrent: [1000] 0 0 0 0 0 0 0 0 0 0
Test.Torrent: [1000] 0 0 0 0 0 0 0 0 0 0
Test.Torrent: [1000] 0 0 0 0 0 0 0 0 0 0
Test.Torrent: [1000] 0 0 0 0 0 0 0 0 0 0
Test.Torrent: [1000] 0 0 0 0 0 0 0 0 0 0
Test.Torrent: [1000] 0 0 0 0 0 0 0 0 0 0
Test.Torrent: *** tracker: "http://tracker2.postman.i2p/announce.php" [ tiers: 0 trackers: 0 i->tier: 0 tier: 2147483647 working: 0 fails: 1 limit: 0 upd: 0 can: 1 sent: 0 ]
Test.Torrent: ==> TRACKER REQUEST "http://tracker2.postman.i2p/announce.php" event: started abort: 0
Test.Torrent (http://tracker2.postman.i2p/announce.php) sending announce (started)
Test.Torrent: *** tracker: "http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a" [ tiers: 0 trackers: 0 i->tier: 1 tier: 2147483647 working: 0 fails: 1 limit: 0 upd: 0 can: 1 sent: 1 ]
Test.Torrent: ==> TRACKER REQUEST "http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a" event: started abort: 0
Test.Torrent (http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a) sending announce (started)
Test.Torrent: *** tracker: "http://tracker2.postman.i2p/announce.php" [ tiers: 0 trackers: 0 found: 0 i->tier: 0 tier: 2147483647 working: 0 fails: 1 limit: 0 upd: 1 ]
Test.Torrent: *** update tracker timer: next_announce < now 0 m_waiting_tracker: 0 next_announce_in: 877468250
Test.Torrent: *** tracker error: (161)  Waiting for i2p acceptor from SAM bridge
Test.Torrent: *** increment tracker fail count [2]
Test.Torrent (http://tracker2.postman.i2p/announce.php) (-1)  "Waiting for i2p acceptor from SAM bridge" (2)
Test.Torrent: *** tracker: "http://tracker2.postman.i2p/announce.php" [ tiers: 0 trackers: 0 i->tier: 0 tier: 2147483647 working: 0 fails: 2 limit: 0 upd: 0 can: 0 sent: 0 ]
Test.Torrent: *** tracker: "http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a" [ tiers: 0 trackers: 0 i->tier: 1 tier: 2147483647 working: 0 fails: 1 limit: 0 upd: 1 can: 0 sent: 0 ]
Test.Torrent: *** tracker: "http://tracker2.postman.i2p/announce.php" [ tiers: 0 trackers: 0 found: 0 i->tier: 0 tier: 2147483647 working: 0 fails: 2 limit: 0 upd: 0 ]
Test.Torrent: *** tracker: "http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a" [ tiers: 0 trackers: 0 found: 0 i->tier: 1 tier: 2147483647 working: 0 fails: 1 limit: 0 upd: 1 ]
Test.Torrent: *** update tracker timer: next_announce < now 0 m_waiting_tracker: 1 next_announce_in: -54
Test.Torrent: *** tracker: "http://tracker2.postman.i2p/announce.php" [ tiers: 0 trackers: 0 found: 0 i->tier: 0 tier: 2147483647 working: 0 fails: 2 limit: 0 upd: 0 ]
Test.Torrent: *** tracker: "http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a" 
[ tiers: 0 trackers: 0 found: 0 i->tier: 1 tier: 2147483647 working: 0 fails: 1 limit: 0 upd: 1 ]
Test.Torrent: *** update tracker timer: next_announce < now 0 m_waiting_tracker: 1 next_announce_in: -55
Test.Torrent: *** tracker error: (161)  Waiting for i2p acceptor from SAM bridge
Test.Torrent: *** increment tracker fail count [2]
Test.Torrent (http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a) (-1)  "Waiting for i2p acceptor from SAM bridge" (2)
Test.Torrent: *** tracker: "http://tracker2.postman.i2p/announce.php" [ tiers: 0 trackers: 0 i->tier: 0 tier: 2147483647 working: 0 fails: 2 limit: 0 upd: 0 can: 0 sent: 0 ]
Test.Torrent: *** tracker: "http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a" [ tiers: 0 trackers: 0 i->tier: 1 tier: 2147483647 working: 0 fails: 2 limit: 0 upd: 0 can: 0 sent: 0 ]
Test.Torrent: *** tracker: "http://tracker2.postman.i2p/announce.php" [ tiers: 0 trackers: 0 found: 0 i->tier: 0 tier: 2147483647 working: 0 fails: 2 limit: 0 upd: 0 ]
Test.Torrent: *** tracker: "http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a" [ tiers: 0 trackers: 0 found: 0 i->tier: 1 tier: 2147483647 working: 0 fails: 2 limit: 0 upd: 0 ]
Test.Torrent: *** update tracker timer: next_announce < now 0 m_waiting_tracker: 1 next_announce_in: -54
Test.Torrent: *** tracker: "http://tracker2.postman.i2p/announce.php" [ tiers: 0 trackers: 0 found: 0 i->tier: 0 tier: 2147483647 working: 0 fails: 2 limit: 0 upd: 0 ]
Test.Torrent: *** tracker: "http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a" [ tiers: 0 trackers: 0 found: 0 i->tier: 1 tier: 2147483647 working: 0 fails: 2 limit: 0 upd: 0 ]
Test.Torrent: *** update tracker timer: next_announce < now 0 m_waiting_tracker: 1 next_announce_in: -55
Test.Torrent: [1000] 0 0 0 0 0 0 0 0 0 0
Test.Torrent: [1000] 0 0 0 0 0 0 0 0 0 0
Test.Torrent: [1000] 0 0 0 0 0 0 0 0 0 0
Test.Torrent: [1000] 0 0 0 0 0 0 0 0 0 0
Test.Torrent: [1000] 0 0 0 0 0 0 0 0 0 0
Test.Torrent: [1000] 0 0 0 0 0 0 0 0 0 0
Test.Torrent: [1000] 0 0 0 0 0 0 0 0 0 0
Test.Torrent: [1000] 0 0 0 0 0 0 0 0 0 0
Test.Torrent: [1000] 0 0 0 0 0 0 0 0 0 0
Test.Torrent: [1000] 0 0 0 0 0 0 0 0 0 0
Test.Torrent: [1000] 0 0 0 0 0 0 0 0 0 0
Test.Torrent: [1000] 0 0 0 0 0 0 0 0 0 0
Test.Torrent: [1000] 0 0 0 0 0 0 0 0 0 0
Test.Torrent: [1000] 0 0 0 0 0 0 0 0 0 0
Test.Torrent: [1000] 0 0 0 0 0 0 0 0 0 0
Test.Torrent: [1000] 0 0 0 0 0 0 0 0 0 0
Test.Torrent: [1000] 0 0 0 0 0 0 0 0 0 0
assertion failed. Please file a bugreport at https://github.com/arvidn/libtorrent/issues
Please include the following information:

version: 1.1.5.0-37ffe99a1

file: 'http_connection.cpp'
line: 498
function: void libtorrent::http_connection::connect_i2p_tracker(const char*)
expression: m_sock.get<socket_type>()

stack:
1: assert_fail(char const*, int, char const*, char const*, char const*, int)
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13: clone


Thread 2 "i2p_torrents" received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffff5d6f700 (LWP 21680)]
__GI_raise (sig=<optimized out>) at ../sysdeps/unix/sysv/linux/raise.c:51
51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb)
(gdb)
(gdb)
(gdb) quit

Also, i turned off the openssl. I get the error in the different place

Test.Torrent: [1000] 0 0 0 0 0 0 0 0 0 0
Test.Torrent: [1000] 0 0 0 0 0 0 0 0 0 0
assertion failed. Please file a bugreport at https://github.com/arvidn/libtorrent/issues
Please include the following information:

version: 1.1.5.0-37ffe99a1

file: 'http_connection.cpp'
line: 631
function: void libtorrent::http_connection::on_connect(const boost::system::error_code&)
expression: m_connecting

stack:
1: assert_fail(char const, int, char const, char const, char const, int)
2:
3:
4:
5:
6:
7:
8:
9:
10:
11: clone

yeah, it seems like there's an issue with the i2p support in the http_connection or http_tracker_connection. The proper fix for this includes implementing a simple mock SAM server in the simulator, to be able to have tests. The reason I haven't done that yet is that I haven't really considered i2p support a critical (or particularly popular) feature.

this error message: "* tracker error: (161) Waiting for i2p acceptor from SAM bridge"
suggests that the SAM connection isn't being established correctly. That's no excuse to assert or crash obviously, but it might be worth looking at what might be going on with the bridge if you want to get it to work.

specifically, it means the local i2p endpoint has not been looked up yet (which is done by the SAM name lookup of "ME"). It either means we haven't even connected yet, or the name lookup hasn't returned (which presumably means something is wrong)

@reichKV do you think you will have a chance to try that patch?

Sure i will try to do it

Sorry for the delay. I understand that i am probably the only one in the world who uses libtorrent in i2p. I need this for educational purposes. And I appreciate your help.

i used your pathes and with the test program, which i described above, i get the following

  1. No crashes.
  2. However the program starts and almost immediately stops. The alerts are:

added torrent: test.mkv
test.mkv added
test.mkv: creating torrent: test.mkv max-uploads: -1 max-connections: -1 upload-limit: -1 download-limit: -1 flags: apply-ip-filter paused auto-managed update-subscribe save-path: /tmp/
test.mkv: * set-max-uploads: 16777215
test.mkv:
set-max-connections: 16777215
test.mkv:
UPDATE LIST [ torrent_want_scrape : 1 ]
test.mkv: init torrent: test.mkv
test.mkv: init, async_check_fastresume
test.mkv: fastresume data accepted
test.mkv: state changed to: downloading
test.mkv: set_state() 3
test.mkv:
UPDATE LIST [ torrent_downloading_auto_managed : 1 ]
test.mkv checked
test.mkv: start_announcing(), paused
test.mkv: auto manager starting torrent
test.mkv:
UPDATE LIST [ torrent_want_scrape : 0 ]
test.mkv resumed
test.mkv:
UPDATE LIST [ torrent_want_tick : 1 ]
test.mkv:
tracker: "http://tracker2.postman.i2p/announce.php" [ tiers: 0 trackers: 0 i->tier: 0 tier: 2147483647 working: 1 fails: 0 limit: 0 upd: 0 can: 1 sent: 0 ]
test.mkv: ==> TRACKER REQUEST "http://tracker2.postman.i2p/announce.php" event: started abort: 0
test.mkv:
QUEUE_TRACKER_REQUEST [ listen_port: 0 ]
test.mkv (http://tracker2.postman.i2p/announce.php) sending announce (started)
test.mkv:
tracker: "http://tracker2.postman.i2p/announce.php" [ tiers: 0 trackers: 0 found: 0 i->tier: 0 tier: 2147483647 working: 1 fails: 0 limit: 0 upd: 1 ]
test.mkv:
update tracker timer: next_announce < now 0 m_waiting_tracker: 0 next_announce_in: 878891115
test.mkv: [1402] 0 0 0 0 0 0 0 0 0 0
test.mkv:
tracker error: (161) Waiting for i2p acceptor from SAM bridge
test.mkv:
increment tracker fail count [1]
test.mkv (http://tracker2.postman.i2p/announce.php) (-1) "Waiting for i2p acceptor from SAM bridge" (1)
test.mkv:
tracker: "http://tracker2.postman.i2p/announce.php" [ tiers: 0 trackers: 0 i->tier: 0 tier: 2147483647 working: 0 fails: 1 limit: 0 upd: 0 can: 0 sent: 0 ]
test.mkv:
tracker: "http://tracker2.postman.i2p/announce.php" [ tiers: 0 trackers: 0 found: 0 i->tier: 0 tier: 2147483647 working: 0 fails: 1 limit: 0 upd: 0 ]
test.mkv:
update tracker timer: next_announce < now 0 m_waiting_tracker: 1 next_announce_in: -17
test.mkv:
tracker: "http://tracker2.postman.i2p/announce.php" [ tiers: 0 trackers: 0 found: 0 i->tier: 0 tier: 2147483647 working: 0 fails: 1 limit: 0 upd: 0 ]
test.mkv: *
* update tracker timer: next_announce < now 0 m_waiting_tracker: 1 next_announce_in: -17
test.mkv: [1000] 0 0 0 0 0 0 0 0 0 0
test.mkv: [1000] 0 0 0 0 0 0 0 0 0 0

In the i2pd console i see the following:

22:12:22@698/info - Clients: starting SAM bridge at 127.0.0.1:7656
22:13:04@115/debug - SAM: new connection from 127.0.0.1:53036
22:13:04@115/error - SAM: handshake read error: End of file
22:13:04@115/debug - SAMSocket::CloseStream, reason: SAM: handshake read error
22:13:04@115/debug - SAMSocket::CloseStream, reason: ~SAMSocket()
22:15:47@115/debug - SAM: new connection from 127.0.0.1:53206
22:15:47@115/debug - SAM: handshake HELLO VERSION MIN=3.0 MAX=3.0
22:15:47@115/error - SAM: read error: End of file
22:15:47@115/debug - SAMSocket::CloseStream, reason: SAM: read error
22:15:47@115/debug - SAMSocket::CloseStream, reason: ~SAMSocket()
22:15:58@115/debug - SAM: new connection from 127.0.0.1:53210
22:15:58@115/debug - SAM: handshake HELLO VERSION MIN=3.0 MAX=3.0
22:15:58@115/debug - SAM: session create: STYLE=STREAM ID=67c6697351ff4aec29cdbaabf2fbe3467cc254f8 DESTINATION=TRANSIENT
22:16:18@115/debug - SAMSocket::SendMessageReply, close=false reason: SESSION STATUS RESULT=OK DESTINATION=8CCWXo2kGoyBlNpzO-2ZE2worlht4qEkwhT-..................
22:16:18@115/error - SAM: read error: End of file
22:16:18@115/debug - SAMSocket::CloseStream, reason: SAM: read error
22:16:18@115/debug - SAMSocket::CloseStream, reason: ~SAMSocket()

Previously i got the errors with the standard java i2p and c++ i2p. Right now i used c++ i2p. I can do the same with java i2p if you think the problem can be with the router

@ReichKV you're certainly not the only one, I just encountered the same bug. This is also a blocker for qBittorrent implementing it. With the death of Net Neutrality and more ISPs throttling/blocking torrents, I think this issue will begin to see more popularity. Hopefully it will get resolved soon so that we can get libtorrent-based torrent clients back on the network.

Possibly related:

I2P developers told me that the implementation of SAM control protocol in the official libtorrent is not complete. The b32 announce protocol was not implemented, and only b64 announce protocol was implemented, but it is not supported by postman.i2p tracker.

Is I2P ready for real use? I'm interested in the implementation of this functionality in my app, but as far as I understand this feature is still buggy.

there's a bit of a chicken and egg-problem. i2p has definitely worked. Last time I looked at it I made some fixes and got it to work. The problem is that there are no unit tests to ensure that it keeps working, and nobody really seems to care (enough at least).

If you would want this to get into a reliable shape (for all I know it is in a good shape, just not reliable because there are no regression tests), please test it out and report errors. Or better yet, write some tests to demonstrate problems!

I would love to see libtorrent get fuller support for i2p, if possible. And, further, it would be nice if some standard could be drawn up to help humans know whether torrents are bridged between i2p and clearnet. For example, trackers might support a flag to indicate whether they have peers on either network, and a DHT node might return a flag to show they're bridging i2p and clearnet also. That might allow clearnet torrent trackers to start marking torrents as being "darknet enabled", helping to encourage more secure and private torrenting.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

peter279k picture peter279k  路  8Comments

techtonik picture techtonik  路  12Comments

pavel-pimenov picture pavel-pimenov  路  5Comments

FranciscoPombal picture FranciscoPombal  路  5Comments

dessalines picture dessalines  路  7Comments