fix torrent state printing in client_test example

This commit is contained in:
arvidn 2018-01-28 14:56:29 +01:00 committed by Arvid Norberg
parent 070d1cd61f
commit a3a38b4d64
1 changed files with 9 additions and 11 deletions

View File

@ -48,23 +48,21 @@ std::string torrent_state(lt::torrent_status const& s)
if (s.errc) return s.errc.message();
std::string ret;
if ((s.flags & lt::torrent_flags::paused) &&
!(s.flags & lt::torrent_flags::auto_managed))
{
ret += "paused";
}
else if ((s.flags & lt::torrent_flags::paused) &&
(s.flags & lt::torrent_flags::auto_managed))
{
ret += "queued";
ret += "queued ";
}
else if ((s.flags & lt::torrent_flags::upload_mode)) ret += "upload mode";
if ((s.flags & lt::torrent_flags::upload_mode)) ret += "upload mode";
else ret += state_str[s.state];
if (!(s.flags & lt::torrent_flags::paused) &&
!(s.flags & lt::torrent_flags::auto_managed))
if (!(s.flags & lt::torrent_flags::auto_managed))
{
ret += " [F]";
if (s.flags & lt::torrent_flags::paused)
ret += " [P]";
else
ret += " [F]";
}
ret += state_str[s.state];
char buf[10];
std::snprintf(buf, sizeof(buf), " (%.1f%%)", s.progress_ppm / 10000.f);
ret += buf;