merged i2p fix from RC_0_16

This commit is contained in:
Arvid Norberg 2013-10-28 02:41:54 +00:00
parent 146fee37e9
commit 4459fd89f7
3 changed files with 6 additions and 17 deletions

View File

@ -156,7 +156,7 @@ private:
}; };
int m_state; int m_state;
#ifdef TORRENT_DEBUG #if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
int m_magic; int m_magic;
#endif #endif
}; };

View File

@ -188,14 +188,14 @@ namespace libtorrent
, m_command(cmd_create_session) , m_command(cmd_create_session)
, m_state(0) , m_state(0)
{ {
#ifdef TORRENT_DEBUG #if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
m_magic = 0x1337; m_magic = 0x1337;
#endif #endif
} }
i2p_stream::~i2p_stream() i2p_stream::~i2p_stream()
{ {
#ifdef TORRENT_DEBUG #if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
TORRENT_ASSERT(m_magic == 0x1337); TORRENT_ASSERT(m_magic == 0x1337);
m_magic = 0; m_magic = 0;
#endif #endif

View File

@ -2620,23 +2620,16 @@ retry:
#if TORRENT_USE_I2P #if TORRENT_USE_I2P
void session_impl::set_i2p_proxy(proxy_settings const& s) void session_impl::set_i2p_proxy(proxy_settings const& s)
{ {
#if defined TORRENT_ASIO_DEBUGGING
add_outstanding_async("session_impl::on_i2p_open");
#endif
// we need this socket to be open before we // we need this socket to be open before we
// can make name lookups for trackers for instance. // can make name lookups for trackers for instance.
// pause the session now and resume it once we've // pause the session now and resume it once we've
// established the i2p SAM connection // established the i2p SAM connection
pause();
m_i2p_conn.open(s, boost::bind(&session_impl::on_i2p_open, this, _1)); m_i2p_conn.open(s, boost::bind(&session_impl::on_i2p_open, this, _1));
open_new_incoming_i2p_connection(); open_new_incoming_i2p_connection();
} }
void session_impl::on_i2p_open(error_code const& ec) void session_impl::on_i2p_open(error_code const& ec)
{ {
#if defined TORRENT_ASIO_DEBUGGING
complete_async("session_impl::on_i2p_open");
#endif
if (ec) if (ec)
{ {
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING #if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
@ -2645,13 +2638,9 @@ retry:
(*m_logger) << msg << "\n"; (*m_logger) << msg << "\n";
#endif #endif
} }
else // now that we have our i2p connection established
{ // it's OK to start torrents and use this socket to
// now that we have our i2p connection established // do i2p name lookups
// it's OK to start torrents and use this socket to
// do i2p name lookups
resume();
}
open_new_incoming_i2p_connection(); open_new_incoming_i2p_connection();
} }