improve error reporting for save resume data for torrents with no metadata

This commit is contained in:
Arvid Norberg 2011-03-04 06:17:55 +00:00
parent a0b6085530
commit cefc97597d
4 changed files with 14 additions and 2 deletions

View File

@ -7439,6 +7439,11 @@ code symbol description
------ ----------------------------------------- -----------------------------------------------------------------
108 too_frequent_pex The peer sent an pex messages too often. This is a possible
attempt of and attack
------ ----------------------------------------- -----------------------------------------------------------------
109 no_metadata The operation failed because it requires the torrent to have
the metadata (.torrent file) and it doesn't have it yet.
This happens for magnet links before they have downloaded the
metadata, and also torrents added by URL.
====== ========================================= =================================================================
NAT-PMP errors:

View File

@ -166,7 +166,7 @@ namespace libtorrent
invalid_pex_message,
invalid_lt_tracker_message,
too_frequent_pex,
reserved109,
no_metadata,
reserved110,
reserved111,
reserved112,

View File

@ -158,7 +158,7 @@ namespace libtorrent
"invalid pex message",
"invalid lt_tracker message",
"pex messages sent too frequent (possible attack)",
"",
"torrent has no metadata",
"",
"",
"",

View File

@ -6007,6 +6007,13 @@ namespace libtorrent
TORRENT_ASSERT(m_ses.is_network_thread());
INVARIANT_CHECK;
if (!valid_metadata())
{
alerts().post_alert(save_resume_data_failed_alert(get_handle()
, errors::no_metadata));
return;
}
if (!m_owning_storage.get())
{
alerts().post_alert(save_resume_data_failed_alert(get_handle()