switched extension handshake parsing over to use lazy_bdecode for improved performance
This commit is contained in:
@@ -278,15 +278,16 @@ namespace libtorrent { namespace
|
||||
}
|
||||
|
||||
// called when the extension handshake from the other end is received
|
||||
virtual bool on_extension_handshake(entry const& h)
|
||||
virtual bool on_extension_handshake(lazy_entry const& h)
|
||||
{
|
||||
m_message_index = 0;
|
||||
entry const* messages = h.find_key("m");
|
||||
if (!messages || messages->type() != entry::dictionary_t) return false;
|
||||
if (h.type() != lazy_entry::dict_t) return false;
|
||||
lazy_entry const* messages = h.dict_find("m");
|
||||
if (!messages || messages->type() != lazy_entry::dict_t) return false;
|
||||
|
||||
entry const* index = messages->find_key("LT_metadata");
|
||||
if (!index || index->type() != entry::int_t) return false;
|
||||
m_message_index = int(index->integer());
|
||||
int index = messages->dict_find_int_value("LT_metadata", -1);
|
||||
if (index == -1) return false;
|
||||
m_message_index = index;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user