forked from premiere/premiere-libtorrent
exception and IPv6 fixes
This commit is contained in:
parent
890811dcc3
commit
c459262c51
|
@ -331,15 +331,19 @@ time_duration rpc_manager::tick()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
m_transactions[m_oldest_transaction_id] = 0;
|
m_transactions[m_oldest_transaction_id] = 0;
|
||||||
#ifdef TORRENT_DHT_VERBOSE_LOGGING
|
#ifdef TORRENT_DHT_VERBOSE_LOGGING
|
||||||
TORRENT_LOG(rpc) << "Timing out transaction id: "
|
TORRENT_LOG(rpc) << "Timing out transaction id: "
|
||||||
<< m_oldest_transaction_id << " from " << o->target_ep();
|
<< m_oldest_transaction_id << " from " << o->target_ep();
|
||||||
#endif
|
#endif
|
||||||
timeouts.push_back(o);
|
timeouts.push_back(o);
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
} catch (std::exception) {}
|
} catch (std::exception) {}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
std::for_each(timeouts.begin(), timeouts.end(), bind(&observer::timeout, _1));
|
std::for_each(timeouts.begin(), timeouts.end(), bind(&observer::timeout, _1));
|
||||||
|
@ -422,8 +426,10 @@ void rpc_manager::invoke(int message_id, udp::endpoint target_addr
|
||||||
#ifdef TORRENT_DEBUG
|
#ifdef TORRENT_DEBUG
|
||||||
int potential_new_id = m_next_transaction_id;
|
int potential_new_id = m_next_transaction_id;
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
m.transaction_id.clear();
|
m.transaction_id.clear();
|
||||||
std::back_insert_iterator<std::string> out(m.transaction_id);
|
std::back_insert_iterator<std::string> out(m.transaction_id);
|
||||||
io::write_uint16(m_next_transaction_id, out);
|
io::write_uint16(m_next_transaction_id, out);
|
||||||
|
@ -431,15 +437,20 @@ void rpc_manager::invoke(int message_id, udp::endpoint target_addr
|
||||||
o->send(m);
|
o->send(m);
|
||||||
|
|
||||||
o->sent = time_now();
|
o->sent = time_now();
|
||||||
|
#if TORRENT_USE_IPV6
|
||||||
o->target_addr = target_addr.address();
|
o->target_addr = target_addr.address();
|
||||||
|
#else
|
||||||
|
o->target_addr = target_addr.address().to_v4();
|
||||||
|
#endif
|
||||||
o->port = target_addr.port();
|
o->port = target_addr.port();
|
||||||
|
|
||||||
#ifdef TORRENT_DHT_VERBOSE_LOGGING
|
#ifdef TORRENT_DHT_VERBOSE_LOGGING
|
||||||
TORRENT_LOG(rpc) << "Invoking " << messages::ids[message_id]
|
TORRENT_LOG(rpc) << "Invoking " << messages::ids[message_id]
|
||||||
<< " -> " << target_addr;
|
<< " -> " << target_addr;
|
||||||
#endif
|
#endif
|
||||||
m_send(m);
|
m_send(m);
|
||||||
new_transaction_id(o);
|
new_transaction_id(o);
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
}
|
}
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
|
@ -447,6 +458,7 @@ void rpc_manager::invoke(int message_id, udp::endpoint target_addr
|
||||||
TORRENT_ASSERT(potential_new_id == m_next_transaction_id);
|
TORRENT_ASSERT(potential_new_id == m_next_transaction_id);
|
||||||
o->abort();
|
o->abort();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void rpc_manager::reply(msg& m)
|
void rpc_manager::reply(msg& m)
|
||||||
|
|
Loading…
Reference in New Issue