Wait for i2p acceptor before announcing

This somewhat closes #1 in an ugly way
This commit is contained in:
Mikhail Titov 2015-06-20 19:35:33 -05:00
parent fda379729c
commit 3f2e660fcf
2 changed files with 6 additions and 1 deletions

View File

@ -397,6 +397,8 @@ namespace libtorrent
// The URL specified an i2p address, but no i2p router is configured
no_i2p_router = 160,
// i2p acceptor is not available yet, can't announce without endpoint
no_i2p_endpoint = 161,

View File

@ -168,7 +168,10 @@ namespace libtorrent
#if TORRENT_USE_I2P
if (i2p && tracker_req().i2pconn)
{
url += "&ip=" + tracker_req ().i2pconn->local_endpoint () + ".i2p";
if (tracker_req().i2pconn->local_endpoint().empty())
fail(error_code(errors::no_i2p_endpoint), -1, "Waiting for i2p acceptor from SAM bridge", 5);
else
url += "&ip=" + tracker_req ().i2pconn->local_endpoint () + ".i2p";
}
else
#endif