fixed bugs introduced in the http tracker refactoring and the fastresume data writer when the piece picker was deallocated, reported by Massaroddel
This commit is contained in:
parent
fcf211378a
commit
ef9c2aba66
|
@ -1,3 +1,5 @@
|
||||||
|
* fixed bug where the http header parser was case sensitive to the header
|
||||||
|
names.
|
||||||
* Implemented an optmization which frees the piece_picker once a torrent
|
* Implemented an optmization which frees the piece_picker once a torrent
|
||||||
turns into a seed.
|
turns into a seed.
|
||||||
* Added support for uT peer exchange extension, implemented by Massaroddel.
|
* Added support for uT peer exchange extension, implemented by Massaroddel.
|
||||||
|
|
|
@ -171,21 +171,7 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
catch(boost::bad_lexical_cast&) {}
|
catch(boost::bad_lexical_cast&) {}
|
||||||
}
|
}
|
||||||
/* else if (name == "content-encoding")
|
|
||||||
{
|
|
||||||
if (value == "gzip" || value == "x-gzip")
|
|
||||||
{
|
|
||||||
m_content_encoding = gzip;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::string error_str = "unknown content encoding in response: \"";
|
|
||||||
error_str += value;
|
|
||||||
error_str += "\"";
|
|
||||||
throw std::runtime_error(error_str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
// TODO: make sure we don't step outside of the buffer
|
// TODO: make sure we don't step outside of the buffer
|
||||||
++pos;
|
++pos;
|
||||||
++m_recv_pos;
|
++m_recv_pos;
|
||||||
|
@ -242,16 +228,12 @@ namespace libtorrent
|
||||||
, std::string const& auth)
|
, std::string const& auth)
|
||||||
: tracker_connection(man, req, d, c)
|
: tracker_connection(man, req, d, c)
|
||||||
, m_man(man)
|
, m_man(man)
|
||||||
// , m_state(read_status)
|
|
||||||
// , m_content_encoding(plain)
|
|
||||||
// , m_content_length(0)
|
|
||||||
, m_name_lookup(d)
|
, m_name_lookup(d)
|
||||||
, m_port(port)
|
, m_port(port)
|
||||||
, m_recv_pos(0)
|
, m_recv_pos(0)
|
||||||
, m_buffer(http_buffer_size)
|
, m_buffer(http_buffer_size)
|
||||||
, m_settings(stn)
|
, m_settings(stn)
|
||||||
, m_password(auth)
|
, m_password(auth)
|
||||||
// , m_code(0)
|
|
||||||
, m_timed_out(false)
|
, m_timed_out(false)
|
||||||
{
|
{
|
||||||
const std::string* connect_to_host;
|
const std::string* connect_to_host;
|
||||||
|
@ -535,7 +517,7 @@ namespace libtorrent
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cl < minimum_tracker_response_length && m_parser.status_code() == 200)
|
if (cl > 0 && cl < minimum_tracker_response_length && m_parser.status_code() == 200)
|
||||||
{
|
{
|
||||||
fail(-1, "content-length is smaller than minimum response length");
|
fail(-1, "content-length is smaller than minimum response length");
|
||||||
return;
|
return;
|
||||||
|
@ -561,7 +543,7 @@ namespace libtorrent
|
||||||
|
|
||||||
void http_tracker_connection::on_response()
|
void http_tracker_connection::on_response()
|
||||||
{
|
{
|
||||||
if (!m_parser.finished())
|
if (!m_parser.header_finished())
|
||||||
{
|
{
|
||||||
fail(-1, "premature end of file");
|
fail(-1, "premature end of file");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -455,6 +455,11 @@ namespace libtorrent
|
||||||
entry::list_type& slots = ret["slots"].list();
|
entry::list_type& slots = ret["slots"].list();
|
||||||
std::copy(piece_index.begin(), piece_index.end(), std::back_inserter(slots));
|
std::copy(piece_index.begin(), piece_index.end(), std::back_inserter(slots));
|
||||||
|
|
||||||
|
// blocks per piece
|
||||||
|
int num_blocks_per_piece =
|
||||||
|
static_cast<int>(t->torrent_file().piece_length()) / t->block_size();
|
||||||
|
ret["blocks per piece"] = num_blocks_per_piece;
|
||||||
|
|
||||||
// if this torrent is a seed, we won't have a piece picker
|
// if this torrent is a seed, we won't have a piece picker
|
||||||
// and there will be no half-finished pieces.
|
// and there will be no half-finished pieces.
|
||||||
if (!t->is_seed())
|
if (!t->is_seed())
|
||||||
|
@ -464,11 +469,6 @@ namespace libtorrent
|
||||||
const std::vector<piece_picker::downloading_piece>& q
|
const std::vector<piece_picker::downloading_piece>& q
|
||||||
= p.get_download_queue();
|
= p.get_download_queue();
|
||||||
|
|
||||||
// blocks per piece
|
|
||||||
int num_blocks_per_piece =
|
|
||||||
static_cast<int>(t->torrent_file().piece_length()) / t->block_size();
|
|
||||||
ret["blocks per piece"] = num_blocks_per_piece;
|
|
||||||
|
|
||||||
// unfinished pieces
|
// unfinished pieces
|
||||||
ret["unfinished"] = entry::list_type();
|
ret["unfinished"] = entry::list_type();
|
||||||
entry::list_type& up = ret["unfinished"].list();
|
entry::list_type& up = ret["unfinished"].list();
|
||||||
|
|
Loading…
Reference in New Issue