optimized metadata transfer

This commit is contained in:
Arvid Norberg 2010-12-17 03:12:45 +00:00
parent d554cf88e6
commit cbf9ead9f4
2 changed files with 9 additions and 1 deletions

View File

@ -1,4 +1,5 @@
* optimized swarm startup time (shaved off about 1-2 seconds) * optimized metadata transfer (magnet link) startup time (shaved off about 1 second)
* optimized swarm startup time (shaved off about 1 second)
* support DHT name lookup * support DHT name lookup
* optimized memory usage of torrent_info and file_storage, forcing some API changes * optimized memory usage of torrent_info and file_storage, forcing some API changes
around file_storage and file_entry around file_storage and file_entry

View File

@ -236,6 +236,7 @@ namespace libtorrent { namespace
int metadata_size = h.dict_find_int_value("metadata_size"); int metadata_size = h.dict_find_int_value("metadata_size");
if (metadata_size > 0) if (metadata_size > 0)
m_tp.metadata_size(metadata_size); m_tp.metadata_size(metadata_size);
maybe_send_request();
return true; return true;
} }
@ -342,6 +343,7 @@ namespace libtorrent { namespace
entry const* total_size = msg.find_key("total_size"); entry const* total_size = msg.find_key("total_size");
m_tp.received_metadata(body.begin + len, body.left() - len, piece m_tp.received_metadata(body.begin + len, body.left() - len, piece
, (total_size && total_size->type() == entry::int_t) ? total_size->integer() : 0); , (total_size && total_size->type() == entry::int_t) ? total_size->integer() : 0);
maybe_send_request();
} }
break; break;
case 2: // have no data case 2: // have no data
@ -362,6 +364,11 @@ namespace libtorrent { namespace
} }
virtual void tick() virtual void tick()
{
maybe_send_request();
}
void maybe_send_request()
{ {
// if we don't have any metadata, and this peer // if we don't have any metadata, and this peer
// supports the request metadata extension // supports the request metadata extension