DHT is more forgiving when parsing responses and logs messages that fails to decode

This commit is contained in:
Arvid Norberg 2007-05-08 00:55:43 +00:00
parent a2b359b64e
commit ceb442bea0
2 changed files with 5 additions and 2 deletions

View File

@ -641,8 +641,11 @@ namespace libtorrent { namespace dht
catch (std::exception& e)
{
#ifdef TORRENT_DHT_VERBOSE_LOGGING
int current_buffer = (m_buffer + 1) & 1;
std::string msg(m_in_buf[current_buffer].begin()
, m_in_buf[current_buffer].end());
TORRENT_LOG(dht_tracker) << "invalid incoming packet: "
<< e.what();
<< e.what() << "\n" << msg.c_str() << "\n";
#endif
}
}

View File

@ -117,7 +117,7 @@ bool rpc_manager::incoming(msg const& m)
// if we don't have the transaction id in our
// request list, ignore the packet
if (m.transaction_id.size() != 2)
if (m.transaction_id.size() < 2)
{
#ifdef TORRENT_DHT_VERBOSE_LOGGING
TORRENT_LOG(rpc) << "Reply with invalid transaction id size: "