Skip to content

Commit

Permalink
make message output for torrent_alert more concise
Browse files Browse the repository at this point in the history
  • Loading branch information
arvidn committed Jan 30, 2025
1 parent b5bbe05 commit 979d478
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/alert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ see LICENSE file.
#include "libtorrent/peer_info.hpp"
#include "libtorrent/aux_/ip_helpers.hpp" // for is_v4

#ifndef TORRENT_DISABLE_ALERT_MSG
#include "libtorrent/info_hash.hpp"
#endif

#if TORRENT_ABI_VERSION == 1
#include "libtorrent/write_resume_data.hpp"
#endif
Expand Down Expand Up @@ -90,8 +94,12 @@ namespace libtorrent {
#ifdef TORRENT_DISABLE_ALERT_MSG
return {};
#else
if (!handle.is_valid()) return " - ";
return torrent_name();
info_hash_t const ih = handle.info_hashes();
if (ih.has_v2())
return aux::to_hex(span<char const>(ih.v2).first(3));
if (ih.has_v1())
return aux::to_hex(span<char const>(ih.v1).first(3));
return "------";
#endif
}

Expand Down

0 comments on commit 979d478

Please sign in to comment.