Skip to content

Commit 1ac1796

Browse files
committed
Minor polish
1 parent 4f110ce commit 1ac1796

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

src/global_config.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ std::optional<bool> parse_bool(const std::string& _str) {
119119
template <typename T>
120120
const std::map<std::string, T> settings_map;
121121

122-
// Should be fine - possibly try maxing them constexpr
122+
// Should be fine - possibly try making them constexpr
123123
// NOLINTBEGIN(bugprone-throwing-static-initialization)
124124

125125
template <>

src/torrent.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,12 @@ class Torrent {
255255
m_disconnect_callback = std::move(disconnect_callback);
256256
}
257257

258-
void set_not_interested_callback(NotInterestedCallback not_interested_callback) {
258+
/**
259+
* Callback when a peer is not interested anymore, i.e. the remote peer
260+
* is not interested in our pieces anymore.
261+
*/
262+
void set_not_interested_callback(
263+
NotInterestedCallback not_interested_callback) {
259264
m_not_interested_callback = std::move(not_interested_callback);
260265
}
261266

tests/test_integrate.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@
3333
#include "test_main.hpp"
3434
#include "test_utils.hpp"
3535

36+
// Path to the writer executable provided by CMake as a compile definition.
37+
// Example: "C:/path/to/build/src/torrent_writer/zit_torrent_writer"
38+
#ifndef TORRENT_WRITER_EXE
39+
#error "TORRENT_WRITER_EXE not defined"
40+
#endif
41+
3642
using namespace std;
3743
using namespace std::chrono_literals;
3844
using namespace std::string_literals;
@@ -109,11 +115,10 @@ std::string get_host_ip_from_host() {
109115
}
110116

111117
// Generate a .torrent file from data using the test torrent writer
112-
// If `TORRENT_WRITER_EXE` is not available, fall back to existing torrent.
118+
// `TORRENT_WRITER_EXE` is expected to be set by the build system.
113119
fs::path generate_torrent_with_announce(const fs::path& data,
114120
const std::string& announce,
115121
const fs::path& out_dir) {
116-
#ifdef TORRENT_WRITER_EXE
117122
const auto out_torrent =
118123
out_dir / ("gen_" + data.filename().string() + ".torrent");
119124
const std::string cmd = std::string(TORRENT_WRITER_EXE) + " --torrent " +
@@ -124,11 +129,6 @@ fs::path generate_torrent_with_announce(const fs::path& data,
124129
// Use exec() from test_utils.hpp which throws on non-zero exit
125130
exec(cmd);
126131
return out_torrent;
127-
#else
128-
(void)announce;
129-
(void)out_dir;
130-
return data_dir / "1MiB.torrent";
131-
#endif
132132
}
133133

134134
auto start_tracker(const fs::path& data_dir) {

0 commit comments

Comments
 (0)