made torrent_info not rely on exception support

This commit is contained in:
Arvid Norberg
2007-12-28 20:11:10 +00:00
parent 501611173e
commit eb8ea0f461
6 changed files with 164 additions and 69 deletions

View File

@@ -185,7 +185,16 @@ namespace libtorrent { namespace
}
entry metadata = bdecode(m_metadata.begin(), m_metadata.end());
m_torrent.set_metadata(metadata);
std::string error;
if (!m_torrent.set_metadata(metadata, error))
{
// this means the metadata is correct, since we
// verified it against the info-hash, but we
// failed to parse it. Pause the torrent
// TODO: Post an alert!
m_torrent.pause();
return false;
}
// clear the storage for the bitfield
std::vector<bool>().swap(m_have_metadata);