mirror of
https://github.com/transmission/transmission.git
synced 2026-05-08 09:39:08 +01:00
refactor: tidy libtransmission includes (#2316)
This commit is contained in:
@@ -23,12 +23,11 @@
|
||||
|
||||
#include "transmission.h"
|
||||
|
||||
#include "error.h"
|
||||
#include "quark.h"
|
||||
#include "tr-assert.h"
|
||||
#include "utils.h"
|
||||
#include "web-utils.h"
|
||||
|
||||
struct tr_error;
|
||||
|
||||
class tr_announce_list
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -13,9 +13,12 @@
|
||||
#endif
|
||||
|
||||
#include <array>
|
||||
#include <cstddef> // size_t
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#include "transmission.h"
|
||||
|
||||
#include "quark.h"
|
||||
#include "web-utils.h"
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <climits> /* USHRT_MAX */
|
||||
#include <cstdio> /* fprintf() */
|
||||
#include <cstring> /* strchr(), memcmp(), memcpy() */
|
||||
#include <string_view>
|
||||
|
||||
#include <event2/buffer.h>
|
||||
#include <event2/http.h> /* for HTTP_OK */
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <cerrno> /* errno, EAFNOSUPPORT */
|
||||
#include <cstring> /* memcpy(), memset() */
|
||||
#include <ctime>
|
||||
#include <vector>
|
||||
|
||||
#include <event2/buffer.h>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <cstdio>
|
||||
#include <cstdlib> /* qsort() */
|
||||
#include <cstring> /* strcmp(), memcpy(), strncmp() */
|
||||
#include <ctime>
|
||||
#include <set>
|
||||
#include <string_view>
|
||||
#include <unordered_map>
|
||||
|
||||
@@ -12,7 +12,10 @@
|
||||
#error only libtransmission should #include this header.
|
||||
#endif
|
||||
|
||||
#include <cstddef> // size_t
|
||||
|
||||
#include "transmission.h"
|
||||
|
||||
#include "quark.h"
|
||||
|
||||
struct tr_announcer;
|
||||
|
||||
@@ -13,9 +13,11 @@
|
||||
#endif
|
||||
|
||||
#include <array>
|
||||
#include <cstddef> // size_t
|
||||
#include <vector>
|
||||
|
||||
#include "transmission.h"
|
||||
|
||||
#include "tr-assert.h"
|
||||
|
||||
class tr_peerIo;
|
||||
|
||||
@@ -161,17 +161,11 @@ bool tr_bitfield::testFlag(size_t n) const
|
||||
****
|
||||
***/
|
||||
|
||||
#ifdef TR_ENABLE_ASSERTS
|
||||
|
||||
bool tr_bitfield::assertValid() const
|
||||
bool tr_bitfield::isValid() const
|
||||
{
|
||||
TR_ASSERT(std::empty(flags_) || true_count_ == countFlags());
|
||||
|
||||
return true;
|
||||
return std::empty(flags_) || true_count_ == countFlags();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
std::vector<uint8_t> tr_bitfield::raw() const
|
||||
{
|
||||
auto const n = getBytesNeeded(bit_count_);
|
||||
@@ -238,7 +232,7 @@ void tr_bitfield::setTrueCount(size_t n)
|
||||
freeArray();
|
||||
}
|
||||
|
||||
TR_ASSERT(assertValid());
|
||||
TR_ASSERT(isValid());
|
||||
}
|
||||
|
||||
void tr_bitfield::rebuildTrueCount()
|
||||
@@ -269,7 +263,7 @@ void tr_bitfield::decrementTrueCount(size_t dec)
|
||||
tr_bitfield::tr_bitfield(size_t bit_count)
|
||||
: bit_count_{ bit_count }
|
||||
{
|
||||
TR_ASSERT(assertValid());
|
||||
TR_ASSERT(isValid());
|
||||
}
|
||||
|
||||
void tr_bitfield::setHasNone()
|
||||
@@ -279,7 +273,7 @@ void tr_bitfield::setHasNone()
|
||||
have_all_hint_ = false;
|
||||
have_none_hint_ = true;
|
||||
|
||||
TR_ASSERT(assertValid());
|
||||
TR_ASSERT(isValid());
|
||||
}
|
||||
|
||||
void tr_bitfield::setHasAll()
|
||||
@@ -289,7 +283,7 @@ void tr_bitfield::setHasAll()
|
||||
have_all_hint_ = true;
|
||||
have_none_hint_ = false;
|
||||
|
||||
TR_ASSERT(assertValid());
|
||||
TR_ASSERT(isValid());
|
||||
}
|
||||
|
||||
void tr_bitfield::setRaw(uint8_t const* raw, size_t byte_count)
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
#include "tr-assert.h"
|
||||
|
||||
/**
|
||||
* @brief Implementation of the BitTorrent spec's Bitfield array of bits.
|
||||
*
|
||||
@@ -98,9 +96,7 @@ public:
|
||||
return size() == 0;
|
||||
}
|
||||
|
||||
#ifdef TR_ENABLE_ASSERTS
|
||||
bool assertValid() const;
|
||||
#endif
|
||||
bool isValid() const;
|
||||
|
||||
private:
|
||||
std::vector<uint8_t> flags_;
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
||||
#include <event2/util.h>
|
||||
|
||||
#include "transmission.h"
|
||||
|
||||
#include "block-info.h"
|
||||
#include "tr-assert.h"
|
||||
|
||||
// Decide on a block size. Constraints:
|
||||
// (1) most clients decline requests over 16 KiB
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
|
||||
#include "transmission.h"
|
||||
|
||||
#include "metainfo.h"
|
||||
|
||||
struct tr_block_info
|
||||
{
|
||||
uint64_t total_size = 0;
|
||||
|
||||
@@ -12,10 +12,7 @@
|
||||
#error only libtransmission should #include this header.
|
||||
#endif
|
||||
|
||||
#include "tr-macros.h"
|
||||
|
||||
struct tr_address;
|
||||
|
||||
struct tr_blocklistFile;
|
||||
|
||||
tr_blocklistFile* tr_blocklistFileNew(char const* filename, bool isEnabled);
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include <cstdlib> /* qsort() */
|
||||
#include <ctime>
|
||||
|
||||
#include <event2/buffer.h>
|
||||
|
||||
|
||||
@@ -12,10 +12,11 @@
|
||||
#error only libtransmission should #include this header.
|
||||
#endif
|
||||
|
||||
#include "tr-macros.h"
|
||||
#include <cstdint> // intX_t, uintX_t
|
||||
|
||||
struct evbuffer;
|
||||
struct tr_cache;
|
||||
struct tr_torrent;
|
||||
|
||||
/***
|
||||
****
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <cctype> /* isprint() */
|
||||
#include <cstdlib> /* strtol() */
|
||||
#include <cstring>
|
||||
#include <iterator>
|
||||
#include <optional>
|
||||
#include <string_view>
|
||||
#include <tuple>
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#error only libtransmission should #include this header.
|
||||
#endif
|
||||
|
||||
#include <cstddef> // size_t
|
||||
|
||||
#include "tr-macros.h"
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <cstddef> // size_t
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <cstdarg>
|
||||
#include <cstring> /* memcpy(), memmove(), memset(), strcmp(), strlen() */
|
||||
#include <random> /* random_device, mt19937, uniform_int_distribution*/
|
||||
#include <string_view>
|
||||
|
||||
#include <arc4.h>
|
||||
|
||||
|
||||
@@ -6,7 +6,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <cstdarg>
|
||||
|
||||
#include "transmission.h"
|
||||
|
||||
#include "error.h"
|
||||
#include "tr-assert.h"
|
||||
#include "utils.h"
|
||||
@@ -22,7 +25,7 @@ tr_error* tr_error_new_literal(int code, char const* message)
|
||||
return error;
|
||||
}
|
||||
|
||||
tr_error* tr_error_new_valist(int code, char const* message_format, va_list args)
|
||||
static tr_error* tr_error_new_valist(int code, char const* message_format, va_list args)
|
||||
{
|
||||
TR_ASSERT(message_format != nullptr);
|
||||
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "tr-macros.h"
|
||||
|
||||
/**
|
||||
@@ -36,17 +34,6 @@ struct tr_error
|
||||
*/
|
||||
tr_error* tr_error_new_literal(int code, char const* message);
|
||||
|
||||
/**
|
||||
* @brief Create new error object using `vprintf`-style formatting.
|
||||
*
|
||||
* @param[in] code Error code (platform-specific).
|
||||
* @param[in] message_format Error message format string.
|
||||
* @param[in] args Format arguments.
|
||||
*
|
||||
* @return Newly allocated error object on success, `nullptr` otherwise.
|
||||
*/
|
||||
tr_error* tr_error_new_valist(int code, char const* message_format, va_list args) TR_GNUC_PRINTF(2, 0);
|
||||
|
||||
/**
|
||||
* @brief Free memory used by error object.
|
||||
*
|
||||
|
||||
@@ -10,16 +10,19 @@
|
||||
#include <cerrno>
|
||||
#include <cinttypes>
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
|
||||
#include "transmission.h"
|
||||
#include "error.h"
|
||||
|
||||
#include "error-types.h"
|
||||
#include "error.h"
|
||||
#include "fdlimit.h"
|
||||
#include "file.h"
|
||||
#include "log.h"
|
||||
#include "session.h"
|
||||
#include "torrent.h" /* tr_isTorrent() */
|
||||
#include "tr-assert.h"
|
||||
#include "utils.h" // tr_time()
|
||||
|
||||
#define dbgmsg(...) tr_logAddDeepNamed(nullptr, __VA_ARGS__)
|
||||
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
|
||||
#include "transmission.h"
|
||||
|
||||
#include "block-info.h"
|
||||
#include "file-piece-map.h"
|
||||
#include "tr-assert.h"
|
||||
|
||||
void tr_file_piece_map::reset(tr_block_info const& block_info, uint64_t const* file_sizes, size_t n_files)
|
||||
{
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#error only libtransmission should #include this header.
|
||||
#endif
|
||||
|
||||
#include <cstddef> // size_t
|
||||
#include <vector>
|
||||
|
||||
#include "transmission.h"
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include <ctype.h> /* isalpha() */
|
||||
#include <string_view>
|
||||
|
||||
#include <shlobj.h> /* SHCreateDirectoryEx() */
|
||||
#include <winioctl.h> /* FSCTL_SET_SPARSE */
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cinttypes>
|
||||
#include <ctime>
|
||||
#include <string_view>
|
||||
#include <inttypes.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "transmission.h"
|
||||
|
||||
#include "crypto-utils.h"
|
||||
#include "error.h"
|
||||
#include "error-types.h"
|
||||
#include "magnet-metainfo.h"
|
||||
#include "tr-assert.h"
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#error only libtransmission should #include this header.
|
||||
#endif
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
@@ -20,9 +19,10 @@
|
||||
#include "transmission.h"
|
||||
|
||||
#include "announce-list.h"
|
||||
#include "error.h"
|
||||
#include "quark.h"
|
||||
#include "tr-macros.h"
|
||||
|
||||
struct tr_error;
|
||||
struct tr_variant;
|
||||
|
||||
struct tr_magnet_metainfo
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <cstdlib> /* qsort */
|
||||
#include <cstring> /* strcmp, strlen */
|
||||
#include <mutex>
|
||||
#include <string_view>
|
||||
|
||||
#include <event2/util.h> /* evutil_ascii_strcasecmp() */
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tr-macros.h"
|
||||
#include "transmission.h"
|
||||
|
||||
struct tr_metainfo_builder_file
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include <event2/util.h> // evutil_ascii_strncasecmp()
|
||||
|
||||
#include "transmission.h"
|
||||
|
||||
#include "crypto-utils.h" /* tr_sha1 */
|
||||
@@ -24,7 +26,6 @@
|
||||
#include "platform.h" /* tr_getTorrentDir() */
|
||||
#include "session.h"
|
||||
#include "torrent.h"
|
||||
#include "tr-assert.h"
|
||||
#include "utils.h"
|
||||
#include "variant.h"
|
||||
#include "web-utils.h"
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
|
||||
#include "transmission.h"
|
||||
|
||||
#include "tr-macros.h"
|
||||
|
||||
struct tr_error;
|
||||
struct tr_variant;
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include <cerrno>
|
||||
#include <climits>
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
#include <string_view>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
@@ -39,6 +41,7 @@
|
||||
#include <libutp/utp.h>
|
||||
|
||||
#include "transmission.h"
|
||||
|
||||
#include "fdlimit.h" /* tr_fdSocketClose() */
|
||||
#include "log.h"
|
||||
#include "net.h"
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#error only libtransmission should #include this header.
|
||||
#endif
|
||||
|
||||
#include <cstddef> // size_t
|
||||
#include <string_view>
|
||||
|
||||
#ifdef _WIN32
|
||||
@@ -37,8 +38,6 @@
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#include "tr-macros.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
using tr_socket_t = SOCKET;
|
||||
#define TR_BAD_SOCKET INVALID_SOCKET
|
||||
|
||||
@@ -16,13 +16,17 @@
|
||||
***
|
||||
**/
|
||||
|
||||
#include <ctime>
|
||||
|
||||
#include <event2/buffer.h>
|
||||
|
||||
#include "transmission.h"
|
||||
|
||||
#include "bandwidth.h"
|
||||
#include "crypto.h"
|
||||
#include "net.h" /* tr_address */
|
||||
#include "peer-socket.h"
|
||||
#include "tr-assert.h"
|
||||
#include "utils.h" // tr_time()
|
||||
|
||||
class tr_peerIo;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <ctime>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <numeric>
|
||||
@@ -18,6 +19,7 @@
|
||||
#define LIBTRANSMISSION_PEER_MODULE
|
||||
|
||||
#include "peer-mgr-active-requests.h"
|
||||
#include "tr-assert.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
@@ -16,8 +16,10 @@
|
||||
#define LIBTRANSMISSION_PEER_MODULE
|
||||
|
||||
#include "transmission.h"
|
||||
|
||||
#include "crypto-utils.h" // tr_rand_buffer()
|
||||
#include "peer-mgr-wishlist.h"
|
||||
#include "tr-assert.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
@@ -12,7 +12,11 @@
|
||||
#error only the libtransmission peer module should #include this header.
|
||||
#endif
|
||||
|
||||
#include <cstddef> // size_t
|
||||
#include <vector>
|
||||
|
||||
#include "transmission.h"
|
||||
|
||||
#include "torrent.h"
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
#include <climits> /* INT_MAX */
|
||||
#include <cstdlib> /* qsort */
|
||||
#include <cstring> /* memcpy, memcmp, strstr */
|
||||
#include <ctime>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#include <event2/event.h>
|
||||
@@ -786,7 +786,7 @@ static void peerCallbackFunc(tr_peer* peer, tr_peer_event const* e, void* vs)
|
||||
tor->uploadedCur += e->length;
|
||||
tr_announcerAddBytes(tor, TR_ANN_UP, e->length);
|
||||
tr_torrentSetDateActive(tor, now);
|
||||
tr_torrentSetDirty(tor);
|
||||
tor->setDirty();
|
||||
tr_statsAddUploaded(tor->session, e->length);
|
||||
|
||||
if (peer->atom != nullptr)
|
||||
@@ -804,7 +804,7 @@ static void peerCallbackFunc(tr_peer* peer, tr_peer_event const* e, void* vs)
|
||||
|
||||
tor->downloadedCur += e->length;
|
||||
tr_torrentSetDateActive(tor, now);
|
||||
tr_torrentSetDirty(tor);
|
||||
tor->setDirty();
|
||||
|
||||
tr_statsAddDownloaded(tor->session, e->length);
|
||||
|
||||
@@ -1726,8 +1726,8 @@ static auto getPeerStats(tr_peerMsgs const* peer, time_t now, uint64_t now_msec)
|
||||
stats.progress = peer->progress;
|
||||
stats.isUTP = peer->is_utp_connection();
|
||||
stats.isEncrypted = peer->is_encrypted();
|
||||
stats.rateToPeer_KBps = toSpeedKBps(tr_peerGetPieceSpeed_Bps(peer, now_msec, TR_CLIENT_TO_PEER));
|
||||
stats.rateToClient_KBps = toSpeedKBps(tr_peerGetPieceSpeed_Bps(peer, now_msec, TR_PEER_TO_CLIENT));
|
||||
stats.rateToPeer_KBps = tr_toSpeedKBps(tr_peerGetPieceSpeed_Bps(peer, now_msec, TR_CLIENT_TO_PEER));
|
||||
stats.rateToClient_KBps = tr_toSpeedKBps(tr_peerGetPieceSpeed_Bps(peer, now_msec, TR_PEER_TO_CLIENT));
|
||||
stats.peerIsChoked = peer->is_peer_choked();
|
||||
stats.peerIsInterested = peer->is_peer_interested();
|
||||
stats.clientIsChoked = peer->is_client_choked();
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
#error only libtransmission should #include this header.
|
||||
#endif
|
||||
|
||||
#include <inttypes.h> /* uint16_t */
|
||||
#include <cinttypes> // uintX_t
|
||||
#include <cstdlib> // size_t
|
||||
#include <vector>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h> /* struct in_addr */
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <cstdarg>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
#include <iostream>
|
||||
#include <memory> // std::unique_ptr
|
||||
#include <optional>
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
#error only libtransmission should #include this header.
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <cinttypes>
|
||||
#include <ctime>
|
||||
|
||||
#include "peer-common.h"
|
||||
|
||||
class tr_peer;
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
#endif
|
||||
|
||||
#include "net.h"
|
||||
#include "tr-assert.h"
|
||||
#include "tr-macros.h"
|
||||
|
||||
enum tr_peer_socket_type
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <cerrno>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <string_view>
|
||||
|
||||
#include <event2/util.h> /* evutil_ascii_strcasecmp() */
|
||||
|
||||
|
||||
@@ -282,3 +282,12 @@ void tr_ptrArrayRemoveSortedPointer(tr_ptrArray* t, void const* ptr, tr_voidptr_
|
||||
TR_ASSERT(removed == ptr);
|
||||
TR_ASSERT(tr_ptrArrayFindSorted(t, ptr, compare) == nullptr);
|
||||
}
|
||||
|
||||
void* tr_ptrArrayNth(tr_ptrArray* array, int i)
|
||||
{
|
||||
TR_ASSERT(array != nullptr);
|
||||
TR_ASSERT(i >= 0);
|
||||
TR_ASSERT(i < array->n_items);
|
||||
|
||||
return array->items[i];
|
||||
}
|
||||
|
||||
@@ -12,8 +12,11 @@
|
||||
#error only libtransmission should #include this header.
|
||||
#endif
|
||||
|
||||
#include <cstddef> // size_t
|
||||
|
||||
#include "transmission.h"
|
||||
#include "tr-assert.h"
|
||||
|
||||
#include "tr-macros.h"
|
||||
|
||||
/**
|
||||
* @addtogroup utils Utilities
|
||||
@@ -44,14 +47,7 @@ void tr_ptrArrayForeach(tr_ptrArray* array, PtrArrayForeachFunc func);
|
||||
|
||||
/** @brief Return the nth item in a tr_ptrArray
|
||||
@return the nth item in a tr_ptrArray */
|
||||
constexpr void* tr_ptrArrayNth(tr_ptrArray* array, int i)
|
||||
{
|
||||
TR_ASSERT(array != nullptr);
|
||||
TR_ASSERT(i >= 0);
|
||||
TR_ASSERT(i < array->n_items);
|
||||
|
||||
return array->items[i];
|
||||
}
|
||||
void* tr_ptrArrayNth(tr_ptrArray* array, int i);
|
||||
|
||||
/** @brief Remove the last item from the array and return it
|
||||
@return the pointer that's been removed from the array
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
#include <optional>
|
||||
#include <string_view>
|
||||
|
||||
#include "tr-macros.h"
|
||||
|
||||
/* Quarks — a 2-way association between a string and a unique integer identifier */
|
||||
using tr_quark = size_t;
|
||||
|
||||
|
||||
@@ -8,10 +8,12 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include "transmission.h"
|
||||
|
||||
#include "error.h"
|
||||
#include "file.h"
|
||||
#include "log.h"
|
||||
|
||||
@@ -12,7 +12,10 @@
|
||||
#error only libtransmission should #include this header.
|
||||
#endif
|
||||
|
||||
#include "tr-macros.h"
|
||||
#include <cstdint>
|
||||
|
||||
struct tr_ctor;
|
||||
struct tr_torrent;
|
||||
|
||||
enum
|
||||
{
|
||||
|
||||
@@ -9,8 +9,10 @@
|
||||
#include <algorithm>
|
||||
#include <cerrno>
|
||||
#include <cstring> /* memcpy */
|
||||
#include <ctime>
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include <zlib.h>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <cerrno>
|
||||
#include <cstdlib> /* strtol */
|
||||
#include <cstring> /* strcmp */
|
||||
#include <ctime>
|
||||
#include <iterator>
|
||||
#include <numeric>
|
||||
#include <string_view>
|
||||
@@ -481,8 +482,8 @@ static void addPeers(tr_torrent* tor, tr_variant* list)
|
||||
tr_variantDictAddBool(d, TR_KEY_peerIsInterested, peer->peerIsInterested);
|
||||
tr_variantDictAddInt(d, TR_KEY_port, peer->port);
|
||||
tr_variantDictAddReal(d, TR_KEY_progress, peer->progress);
|
||||
tr_variantDictAddInt(d, TR_KEY_rateToClient, toSpeedBytes(peer->rateToClient_KBps));
|
||||
tr_variantDictAddInt(d, TR_KEY_rateToPeer, toSpeedBytes(peer->rateToPeer_KBps));
|
||||
tr_variantDictAddInt(d, TR_KEY_rateToClient, tr_toSpeedBytes(peer->rateToClient_KBps));
|
||||
tr_variantDictAddInt(d, TR_KEY_rateToPeer, tr_toSpeedBytes(peer->rateToPeer_KBps));
|
||||
}
|
||||
|
||||
tr_torrentPeersFree(peers, peerCount);
|
||||
@@ -728,11 +729,11 @@ static void initField(
|
||||
break;
|
||||
|
||||
case TR_KEY_rateDownload:
|
||||
tr_variantInitInt(initme, toSpeedBytes(st->pieceDownloadSpeed_KBps));
|
||||
tr_variantInitInt(initme, tr_toSpeedBytes(st->pieceDownloadSpeed_KBps));
|
||||
break;
|
||||
|
||||
case TR_KEY_rateUpload:
|
||||
tr_variantInitInt(initme, toSpeedBytes(st->pieceUploadSpeed_KBps));
|
||||
tr_variantInitInt(initme, tr_toSpeedBytes(st->pieceUploadSpeed_KBps));
|
||||
break;
|
||||
|
||||
case TR_KEY_recheckProgress:
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstddef> // size_t
|
||||
#include <string_view>
|
||||
|
||||
#include "transmission.h"
|
||||
#include "tr-macros.h"
|
||||
|
||||
/***
|
||||
**** RPC processing
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
#include <string_view>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <sys/stat.h>
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tr-macros.h"
|
||||
|
||||
using tr_session_id_t = struct tr_session_id*;
|
||||
|
||||
/**
|
||||
|
||||
+32
-12
@@ -13,9 +13,11 @@
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <cstring> /* memcpy */
|
||||
#include <ctime>
|
||||
#include <iterator> // std::back_inserter
|
||||
#include <list>
|
||||
#include <numeric> // std::acumulate()
|
||||
#include <string_view>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
@@ -1046,12 +1048,12 @@ static void sessionSetImpl(void* vdata)
|
||||
/* update the turtle mode's fields */
|
||||
if (tr_variantDictFindInt(settings, TR_KEY_alt_speed_up, &i))
|
||||
{
|
||||
turtle->speedLimit_Bps[TR_UP] = toSpeedBytes(i);
|
||||
turtle->speedLimit_Bps[TR_UP] = tr_toSpeedBytes(i);
|
||||
}
|
||||
|
||||
if (tr_variantDictFindInt(settings, TR_KEY_alt_speed_down, &i))
|
||||
{
|
||||
turtle->speedLimit_Bps[TR_DOWN] = toSpeedBytes(i);
|
||||
turtle->speedLimit_Bps[TR_DOWN] = tr_toSpeedBytes(i);
|
||||
}
|
||||
|
||||
if (tr_variantDictFindInt(settings, TR_KEY_alt_speed_time_begin, &i))
|
||||
@@ -1381,7 +1383,7 @@ bool tr_sessionGetActiveSpeedLimit_KBps(tr_session const* session, tr_direction
|
||||
{
|
||||
unsigned int Bps = 0;
|
||||
bool const is_active = tr_sessionGetActiveSpeedLimit_Bps(session, dir, &Bps);
|
||||
*setme_KBps = toSpeedKBps(Bps);
|
||||
*setme_KBps = tr_toSpeedKBps(Bps);
|
||||
return is_active;
|
||||
}
|
||||
|
||||
@@ -1531,7 +1533,7 @@ static void tr_sessionSetSpeedLimit_Bps(tr_session* s, tr_direction d, unsigned
|
||||
|
||||
void tr_sessionSetSpeedLimit_KBps(tr_session* s, tr_direction d, unsigned int KBps)
|
||||
{
|
||||
tr_sessionSetSpeedLimit_Bps(s, d, toSpeedBytes(KBps));
|
||||
tr_sessionSetSpeedLimit_Bps(s, d, tr_toSpeedBytes(KBps));
|
||||
}
|
||||
|
||||
unsigned int tr_sessionGetSpeedLimit_Bps(tr_session const* s, tr_direction d)
|
||||
@@ -1544,7 +1546,7 @@ unsigned int tr_sessionGetSpeedLimit_Bps(tr_session const* s, tr_direction d)
|
||||
|
||||
unsigned int tr_sessionGetSpeedLimit_KBps(tr_session const* s, tr_direction d)
|
||||
{
|
||||
return toSpeedKBps(tr_sessionGetSpeedLimit_Bps(s, d));
|
||||
return tr_toSpeedKBps(tr_sessionGetSpeedLimit_Bps(s, d));
|
||||
}
|
||||
|
||||
void tr_sessionLimitSpeed(tr_session* s, tr_direction d, bool b)
|
||||
@@ -1581,7 +1583,7 @@ static void tr_sessionSetAltSpeed_Bps(tr_session* s, tr_direction d, unsigned in
|
||||
|
||||
void tr_sessionSetAltSpeed_KBps(tr_session* s, tr_direction d, unsigned int KBps)
|
||||
{
|
||||
tr_sessionSetAltSpeed_Bps(s, d, toSpeedBytes(KBps));
|
||||
tr_sessionSetAltSpeed_Bps(s, d, tr_toSpeedBytes(KBps));
|
||||
}
|
||||
|
||||
static unsigned int tr_sessionGetAltSpeed_Bps(tr_session const* s, tr_direction d)
|
||||
@@ -1594,7 +1596,7 @@ static unsigned int tr_sessionGetAltSpeed_Bps(tr_session const* s, tr_direction
|
||||
|
||||
unsigned int tr_sessionGetAltSpeed_KBps(tr_session const* s, tr_direction d)
|
||||
{
|
||||
return toSpeedKBps(tr_sessionGetAltSpeed_Bps(s, d));
|
||||
return tr_toSpeedKBps(tr_sessionGetAltSpeed_Bps(s, d));
|
||||
}
|
||||
|
||||
static void userPokedTheClock(tr_session* s, struct tr_turtle_info* t)
|
||||
@@ -1791,7 +1793,7 @@ static unsigned int tr_sessionGetRawSpeed_Bps(tr_session const* session, tr_dire
|
||||
|
||||
double tr_sessionGetRawSpeed_KBps(tr_session const* session, tr_direction dir)
|
||||
{
|
||||
return toSpeedKBps(tr_sessionGetRawSpeed_Bps(session, dir));
|
||||
return tr_toSpeedKBps(tr_sessionGetRawSpeed_Bps(session, dir));
|
||||
}
|
||||
|
||||
int tr_sessionCountTorrents(tr_session const* session)
|
||||
@@ -2236,14 +2238,14 @@ void tr_sessionSetCacheLimit_MB(tr_session* session, int max_bytes)
|
||||
{
|
||||
TR_ASSERT(tr_isSession(session));
|
||||
|
||||
tr_cacheSetLimit(session->cache, toMemBytes(max_bytes));
|
||||
tr_cacheSetLimit(session->cache, tr_toMemBytes(max_bytes));
|
||||
}
|
||||
|
||||
int tr_sessionGetCacheLimit_MB(tr_session const* session)
|
||||
{
|
||||
TR_ASSERT(tr_isSession(session));
|
||||
|
||||
return toMemMB(tr_cacheGetLimit(session->cache));
|
||||
return tr_toMemMB(tr_cacheGetLimit(session->cache));
|
||||
}
|
||||
|
||||
/***
|
||||
@@ -2486,6 +2488,26 @@ char const* tr_blocklistGetURL(tr_session const* session)
|
||||
****
|
||||
***/
|
||||
|
||||
void tr_session::setRpcWhitelist(std::string_view whitelist) const
|
||||
{
|
||||
tr_rpcSetWhitelist(this->rpc_server_.get(), whitelist);
|
||||
}
|
||||
|
||||
std::string const& tr_session::rpcWhitelist() const
|
||||
{
|
||||
return tr_rpcGetWhitelist(this->rpc_server_.get());
|
||||
}
|
||||
|
||||
void tr_session::useRpcWhitelist(bool enabled) const
|
||||
{
|
||||
tr_rpcSetWhitelistEnabled(this->rpc_server_.get(), enabled);
|
||||
}
|
||||
|
||||
bool tr_session::useRpcWhitelist() const
|
||||
{
|
||||
return tr_rpcGetWhitelistEnabled(this->rpc_server_.get());
|
||||
}
|
||||
|
||||
void tr_sessionSetRPCEnabled(tr_session* session, bool isEnabled)
|
||||
{
|
||||
TR_ASSERT(tr_isSession(session));
|
||||
@@ -2821,7 +2843,6 @@ void tr_sessionAddTorrent(tr_session* session, tr_torrent* tor)
|
||||
session->torrents.insert(tor);
|
||||
session->torrentsById.insert_or_assign(tor->uniqueId, tor);
|
||||
session->torrentsByHash.insert_or_assign(tor->info.hash, tor);
|
||||
session->torrentsByHashString.insert_or_assign(tor->hashString(), tor);
|
||||
}
|
||||
|
||||
void tr_sessionRemoveTorrent(tr_session* session, tr_torrent* tor)
|
||||
@@ -2829,5 +2850,4 @@ void tr_sessionRemoveTorrent(tr_session* session, tr_torrent* tor)
|
||||
session->torrents.erase(tor);
|
||||
session->torrentsById.erase(tor->uniqueId);
|
||||
session->torrentsByHash.erase(tor->info.hash);
|
||||
session->torrentsByHashString.erase(tor->hashString());
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
#include <array>
|
||||
#include <cstring> // memcmp()
|
||||
#include <ctime>
|
||||
#include <list>
|
||||
#include <mutex>
|
||||
#include <map>
|
||||
@@ -25,15 +26,10 @@
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include <event2/util.h> // evutil_ascii_strncasecmp()
|
||||
|
||||
#include "transmission.h"
|
||||
|
||||
#include "bandwidth.h"
|
||||
#include "net.h"
|
||||
#include "rpc-server.h"
|
||||
#include "tr-macros.h"
|
||||
#include "utils.h" // tr_speed_K
|
||||
|
||||
enum tr_auto_switch_state_t
|
||||
{
|
||||
@@ -48,6 +44,8 @@ struct event_base;
|
||||
struct evdns_base;
|
||||
|
||||
class tr_bitfield;
|
||||
class tr_rpc_server;
|
||||
struct Bandwidth;
|
||||
struct tr_address;
|
||||
struct tr_announcer;
|
||||
struct tr_announcer_udp;
|
||||
@@ -105,32 +103,6 @@ struct CompareHash
|
||||
}
|
||||
};
|
||||
|
||||
struct CaseInsensitiveStringCompare // case-insensitive string compare
|
||||
{
|
||||
int compare(std::string_view a, std::string_view b) const // <=>
|
||||
{
|
||||
auto const alen = std::size(a);
|
||||
auto const blen = std::size(b);
|
||||
|
||||
if (auto i = evutil_ascii_strncasecmp(std::data(a), std::data(b), std::min(alen, blen)); i != 0)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
if (alen != blen)
|
||||
{
|
||||
return alen < blen ? -1 : 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool operator()(std::string_view a, std::string_view b) const // less than
|
||||
{
|
||||
return compare(a, b) < 0;
|
||||
}
|
||||
};
|
||||
|
||||
/** @brief handle to an active libtransmission session */
|
||||
struct tr_session
|
||||
{
|
||||
@@ -222,25 +194,13 @@ public:
|
||||
|
||||
// RPC
|
||||
|
||||
void setRpcWhitelist(std::string_view whitelist)
|
||||
{
|
||||
tr_rpcSetWhitelist(this->rpc_server_.get(), whitelist);
|
||||
}
|
||||
void setRpcWhitelist(std::string_view whitelist) const;
|
||||
|
||||
std::string const& rpcWhitelist() const
|
||||
{
|
||||
return tr_rpcGetWhitelist(this->rpc_server_.get());
|
||||
}
|
||||
std::string const& rpcWhitelist() const;
|
||||
|
||||
void useRpcWhitelist(bool enabled)
|
||||
{
|
||||
tr_rpcSetWhitelistEnabled(this->rpc_server_.get(), enabled);
|
||||
}
|
||||
void useRpcWhitelist(bool enabled) const;
|
||||
|
||||
bool useRpcWhitelist() const
|
||||
{
|
||||
return tr_rpcGetWhitelistEnabled(this->rpc_server_.get());
|
||||
}
|
||||
bool useRpcWhitelist() const;
|
||||
|
||||
// peer networking
|
||||
|
||||
@@ -341,7 +301,6 @@ public:
|
||||
std::unordered_set<tr_torrent*> torrents;
|
||||
std::map<int, tr_torrent*> torrentsById;
|
||||
std::map<uint8_t const*, tr_torrent*, CompareHash> torrentsByHash;
|
||||
std::map<std::string_view, tr_torrent*, CaseInsensitiveStringCompare> torrentsByHashString;
|
||||
|
||||
char* configDir;
|
||||
char* resumeDir;
|
||||
@@ -446,31 +405,6 @@ constexpr bool tr_isPriority(tr_priority_t p)
|
||||
****
|
||||
***/
|
||||
|
||||
static inline unsigned int toSpeedBytes(unsigned int KBps)
|
||||
{
|
||||
return KBps * tr_speed_K;
|
||||
}
|
||||
|
||||
static inline double toSpeedKBps(unsigned int Bps)
|
||||
{
|
||||
return Bps / (double)tr_speed_K;
|
||||
}
|
||||
|
||||
static inline uint64_t toMemBytes(unsigned int MB)
|
||||
{
|
||||
uint64_t B = (uint64_t)tr_mem_K * tr_mem_K;
|
||||
B *= MB;
|
||||
return B;
|
||||
}
|
||||
|
||||
static inline int toMemMB(uint64_t B)
|
||||
{
|
||||
return (int)(B / (tr_mem_K * tr_mem_K));
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
unsigned int tr_sessionGetSpeedLimit_Bps(tr_session const*, tr_direction);
|
||||
unsigned int tr_sessionGetPieceSpeed_Bps(tr_session const*, tr_direction);
|
||||
|
||||
|
||||
@@ -6,10 +6,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <ctime>
|
||||
|
||||
#include "transmission.h"
|
||||
#include "session.h"
|
||||
|
||||
#include "log.h"
|
||||
#include "platform.h" /* tr_sessionGetConfigDir() */
|
||||
#include "session.h"
|
||||
#include "stats.h"
|
||||
#include "utils.h"
|
||||
#include "variant.h"
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <cerrno>
|
||||
#include <csignal>
|
||||
#include <cstdlib>
|
||||
#include <map>
|
||||
#include <string_view>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <cwchar>
|
||||
#include <map>
|
||||
#include <string_view>
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
#include <map>
|
||||
#include <string_view>
|
||||
|
||||
#include "tr-macros.h"
|
||||
struct tr_error;
|
||||
|
||||
bool tr_spawn_async(
|
||||
char const* const* cmd,
|
||||
std::map<std::string_view, std::string_view> const& env,
|
||||
char const* work_dir,
|
||||
struct tr_error** error);
|
||||
tr_error** error);
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <cerrno> /* EINVAL */
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include "transmission.h"
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
#include <climits> /* INT_MAX */
|
||||
#include <cstring> /* memcpy(), memset(), memcmp() */
|
||||
#include <ctime>
|
||||
#include <string_view>
|
||||
|
||||
#include <event2/buffer.h>
|
||||
|
||||
@@ -311,7 +313,7 @@ void tr_torrentSetMetadataPiece(tr_torrent* tor, int piece, void const* data, in
|
||||
/* save the new .torrent file */
|
||||
tr_variantToFile(&newMetainfo, TR_VARIANT_FMT_BENC, tor->torrentFile());
|
||||
tr_torrentGotNewInfoDict(tor);
|
||||
tr_torrentSetDirty(tor);
|
||||
tor->setDirty();
|
||||
}
|
||||
|
||||
tr_variantFree(&newMetainfo);
|
||||
@@ -329,7 +331,7 @@ void tr_torrentSetMetadataPiece(tr_torrent* tor, int piece, void const* data, in
|
||||
tor->isStopping = true;
|
||||
tor->magnetVerify = true;
|
||||
tor->startAfterVerify = !tor->prefetchMagnetMetadata;
|
||||
tr_torrentMarkEdited(tor);
|
||||
tor->markEdited();
|
||||
}
|
||||
else /* drat. */
|
||||
{
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
#error only libtransmission should #include this header.
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <time.h>
|
||||
#include <cinttypes>
|
||||
#include <ctime>
|
||||
|
||||
// defined by BEP #9
|
||||
inline constexpr int METADATA_PIECE_SIZE = 1024 * 16;
|
||||
|
||||
+52
-40
@@ -15,9 +15,12 @@
|
||||
#include <cstdarg>
|
||||
#include <cstdlib> /* qsort */
|
||||
#include <cstring> /* memcmp */
|
||||
#include <ctime>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
@@ -105,9 +108,9 @@ tr_torrent* tr_torrentFindFromId(tr_session* session, int id)
|
||||
|
||||
tr_torrent* tr_torrentFindFromHashString(tr_session* session, std::string_view hash_string)
|
||||
{
|
||||
auto& src = session->torrentsByHashString;
|
||||
auto it = src.find(hash_string);
|
||||
return it == std::end(src) ? nullptr : it->second;
|
||||
auto info_hash = std::array<uint8_t, TR_SHA1_DIGEST_LEN>{};
|
||||
tr_hex_to_sha1(std::data(info_hash), std::data(hash_string));
|
||||
return tr_torrentFindFromHash(session, std::data(info_hash));
|
||||
}
|
||||
|
||||
tr_torrent* tr_torrentFindFromHash(tr_session* session, uint8_t const* hash)
|
||||
@@ -206,13 +209,13 @@ void tr_torrentSetSpeedLimit_Bps(tr_torrent* tor, tr_direction dir, unsigned int
|
||||
|
||||
if (tor->bandwidth->setDesiredSpeedBytesPerSecond(dir, Bps))
|
||||
{
|
||||
tr_torrentSetDirty(tor);
|
||||
tor->setDirty();
|
||||
}
|
||||
}
|
||||
|
||||
void tr_torrentSetSpeedLimit_KBps(tr_torrent* tor, tr_direction dir, unsigned int KBps)
|
||||
{
|
||||
tr_torrentSetSpeedLimit_Bps(tor, dir, toSpeedBytes(KBps));
|
||||
tr_torrentSetSpeedLimit_Bps(tor, dir, tr_toSpeedBytes(KBps));
|
||||
}
|
||||
|
||||
unsigned int tr_torrentGetSpeedLimit_Bps(tr_torrent const* tor, tr_direction dir)
|
||||
@@ -228,7 +231,7 @@ unsigned int tr_torrentGetSpeedLimit_KBps(tr_torrent const* tor, tr_direction di
|
||||
TR_ASSERT(tr_isTorrent(tor));
|
||||
TR_ASSERT(tr_isDirection(dir));
|
||||
|
||||
return toSpeedKBps(tr_torrentGetSpeedLimit_Bps(tor, dir));
|
||||
return tr_toSpeedKBps(tr_torrentGetSpeedLimit_Bps(tor, dir));
|
||||
}
|
||||
|
||||
void tr_torrentUseSpeedLimit(tr_torrent* tor, tr_direction dir, bool do_use)
|
||||
@@ -238,7 +241,7 @@ void tr_torrentUseSpeedLimit(tr_torrent* tor, tr_direction dir, bool do_use)
|
||||
|
||||
if (tor->bandwidth->setLimited(dir, do_use))
|
||||
{
|
||||
tr_torrentSetDirty(tor);
|
||||
tor->setDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,7 +258,7 @@ void tr_torrentUseSessionLimits(tr_torrent* tor, bool doUse)
|
||||
|
||||
if (tor->bandwidth->honorParentLimits(TR_UP, doUse) || tor->bandwidth->honorParentLimits(TR_DOWN, doUse))
|
||||
{
|
||||
tr_torrentSetDirty(tor);
|
||||
tor->setDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,7 +282,7 @@ void tr_torrentSetRatioMode(tr_torrent* tor, tr_ratiolimit mode)
|
||||
{
|
||||
tor->ratioLimitMode = mode;
|
||||
|
||||
tr_torrentSetDirty(tor);
|
||||
tor->setDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,7 +301,7 @@ void tr_torrentSetRatioLimit(tr_torrent* tor, double desiredRatio)
|
||||
{
|
||||
tor->desiredRatio = desiredRatio;
|
||||
|
||||
tr_torrentSetDirty(tor);
|
||||
tor->setDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -396,7 +399,7 @@ void tr_torrentSetIdleMode(tr_torrent* tor, tr_idlelimit mode)
|
||||
{
|
||||
tor->idleLimitMode = mode;
|
||||
|
||||
tr_torrentSetDirty(tor);
|
||||
tor->setDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -415,7 +418,7 @@ void tr_torrentSetIdleLimit(tr_torrent* tor, uint16_t idleMinutes)
|
||||
{
|
||||
tor->idleLimitMinutes = idleMinutes;
|
||||
|
||||
tr_torrentSetDirty(tor);
|
||||
tor->setDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -874,8 +877,8 @@ void tr_torrentSetDownloadDir(tr_torrent* tor, char const* path)
|
||||
tr_free(tor->downloadDir);
|
||||
tor->downloadDir = tr_strdup(path);
|
||||
|
||||
tr_torrentMarkEdited(tor);
|
||||
tr_torrentSetDirty(tor);
|
||||
tor->markEdited();
|
||||
tor->setDirty();
|
||||
}
|
||||
|
||||
refreshCurrentDir(tor);
|
||||
@@ -947,7 +950,7 @@ void tr_torrentSetVerifyState(tr_torrent* tor, tr_verify_state state)
|
||||
TR_ASSERT(state == TR_VERIFY_NONE || state == TR_VERIFY_WAIT || state == TR_VERIFY_NOW);
|
||||
|
||||
tor->verifyState = state;
|
||||
tor->anyDate = tr_time();
|
||||
tor->markChanged();
|
||||
}
|
||||
|
||||
tr_torrent_activity tr_torrentGetActivity(tr_torrent const* tor)
|
||||
@@ -1035,12 +1038,12 @@ tr_stat const* tr_torrentStat(tr_torrent* tor)
|
||||
s->peersFrom[i] = swarm_stats.peerFromCount[i];
|
||||
}
|
||||
|
||||
s->rawUploadSpeed_KBps = toSpeedKBps(tor->bandwidth->getRawSpeedBytesPerSecond(now, TR_UP));
|
||||
s->rawDownloadSpeed_KBps = toSpeedKBps(tor->bandwidth->getRawSpeedBytesPerSecond(now, TR_DOWN));
|
||||
s->rawUploadSpeed_KBps = tr_toSpeedKBps(tor->bandwidth->getRawSpeedBytesPerSecond(now, TR_UP));
|
||||
s->rawDownloadSpeed_KBps = tr_toSpeedKBps(tor->bandwidth->getRawSpeedBytesPerSecond(now, TR_DOWN));
|
||||
auto const pieceUploadSpeed_Bps = tor->bandwidth->getPieceSpeedBytesPerSecond(now, TR_UP);
|
||||
s->pieceUploadSpeed_KBps = toSpeedKBps(pieceUploadSpeed_Bps);
|
||||
s->pieceUploadSpeed_KBps = tr_toSpeedKBps(pieceUploadSpeed_Bps);
|
||||
auto const pieceDownloadSpeed_Bps = tor->bandwidth->getPieceSpeedBytesPerSecond(now, TR_DOWN);
|
||||
s->pieceDownloadSpeed_KBps = toSpeedKBps(pieceDownloadSpeed_Bps);
|
||||
s->pieceDownloadSpeed_KBps = tr_toSpeedKBps(pieceDownloadSpeed_Bps);
|
||||
|
||||
s->percentComplete = tor->completion.percentComplete();
|
||||
s->metadataPercentComplete = tr_torrentGetMetadataPercent(tor);
|
||||
@@ -1327,7 +1330,7 @@ static void tr_torrentResetTransferStats(tr_torrent* tor)
|
||||
tor->corruptPrev += tor->corruptCur;
|
||||
tor->corruptCur = 0;
|
||||
|
||||
tr_torrentSetDirty(tor);
|
||||
tor->setDirty();
|
||||
}
|
||||
|
||||
/***
|
||||
@@ -1346,7 +1349,6 @@ static void freeTorrent(tr_torrent* tor)
|
||||
|
||||
tr_session* session = tor->session;
|
||||
tr_info* inf = &tor->info;
|
||||
time_t const now = tr_time();
|
||||
|
||||
tr_peerMgrRemoveTorrent(tor);
|
||||
|
||||
@@ -1366,7 +1368,7 @@ static void freeTorrent(tr_torrent* tor)
|
||||
if (t->queuePosition > tor->queuePosition)
|
||||
{
|
||||
t->queuePosition--;
|
||||
t->anyDate = now;
|
||||
t->markChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1400,7 +1402,7 @@ static void torrentStartImpl(void* vtor)
|
||||
tor->isRunning = true;
|
||||
tor->completeness = tor->completion.status();
|
||||
tor->startDate = now;
|
||||
tor->anyDate = now;
|
||||
tor->markChanged();
|
||||
tr_torrentClearError(tor);
|
||||
tor->finishedSeedingByIdle = false;
|
||||
|
||||
@@ -1497,7 +1499,7 @@ static void torrentStart(tr_torrent* tor, bool bypass_queue)
|
||||
* was missed to ensure that we didn't think someone was cheating. */
|
||||
tr_torrentUnsetPeerId(tor);
|
||||
tor->isRunning = true;
|
||||
tr_torrentSetDirty(tor);
|
||||
tor->setDirty();
|
||||
tr_runInEventThread(tor->session, torrentStartImpl, tor);
|
||||
}
|
||||
|
||||
@@ -1668,7 +1670,7 @@ void tr_torrentStop(tr_torrent* tor)
|
||||
tor->isRunning = false;
|
||||
tor->isStopping = false;
|
||||
tor->prefetchMagnetMetadata = false;
|
||||
tr_torrentSetDirty(tor);
|
||||
tor->setDirty();
|
||||
tr_runInEventThread(tor->session, stopTorrent, tor);
|
||||
}
|
||||
}
|
||||
@@ -1932,7 +1934,8 @@ void tr_torrent::recheckCompleteness()
|
||||
if (recentChange)
|
||||
{
|
||||
tr_announcerTorrentCompleted(this);
|
||||
this->doneDate = this->anyDate = tr_time();
|
||||
this->markChanged();
|
||||
this->doneDate = tr_time();
|
||||
}
|
||||
|
||||
if (wasLeeching && wasRunning)
|
||||
@@ -2009,7 +2012,7 @@ void tr_torrentSetLabels(tr_torrent* tor, tr_labels_t&& labels)
|
||||
auto const lock = tor->unique_lock();
|
||||
|
||||
tor->labels = std::move(labels);
|
||||
tr_torrentSetDirty(tor);
|
||||
tor->setDirty();
|
||||
}
|
||||
|
||||
/***
|
||||
@@ -2032,7 +2035,7 @@ void tr_torrentSetPriority(tr_torrent* tor, tr_priority_t priority)
|
||||
{
|
||||
tor->bandwidth->setPriority(priority);
|
||||
|
||||
tr_torrentSetDirty(tor);
|
||||
tor->setDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2048,7 +2051,7 @@ void tr_torrentSetPeerLimit(tr_torrent* tor, uint16_t maxConnectedPeers)
|
||||
{
|
||||
tor->maxConnectedPeers = maxConnectedPeers;
|
||||
|
||||
tr_torrentSetDirty(tor);
|
||||
tor->setDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2178,7 +2181,7 @@ bool tr_torrentSetAnnounceList(tr_torrent* tor, char const* const* announce_urls
|
||||
}
|
||||
|
||||
std::swap(*tor->info.announce_list, announce_list);
|
||||
tr_torrentMarkEdited(tor);
|
||||
tor->markEdited();
|
||||
|
||||
/* if we had a tracker-related error on this torrent,
|
||||
* and that tracker's been removed,
|
||||
@@ -2749,7 +2752,7 @@ void tr_torrentGotBlock(tr_torrent* tor, tr_block_index_t block)
|
||||
if (block_is_new)
|
||||
{
|
||||
tor->completion.addBlock(block);
|
||||
tr_torrentSetDirty(tor);
|
||||
tor->setDirty();
|
||||
|
||||
tr_piece_index_t const p = tor->pieceForBlock(block);
|
||||
|
||||
@@ -2938,7 +2941,6 @@ void tr_torrentSetQueuePosition(tr_torrent* tor, int pos)
|
||||
{
|
||||
int back = -1;
|
||||
int const old_pos = tor->queuePosition;
|
||||
time_t const now = tr_time();
|
||||
|
||||
if (pos < 0)
|
||||
{
|
||||
@@ -2952,13 +2954,13 @@ void tr_torrentSetQueuePosition(tr_torrent* tor, int pos)
|
||||
if ((old_pos < pos) && (old_pos <= walk->queuePosition) && (walk->queuePosition <= pos))
|
||||
{
|
||||
walk->queuePosition--;
|
||||
walk->anyDate = now;
|
||||
walk->markChanged();
|
||||
}
|
||||
|
||||
if ((old_pos > pos) && (pos <= walk->queuePosition) && (walk->queuePosition < old_pos))
|
||||
{
|
||||
walk->queuePosition++;
|
||||
walk->anyDate = now;
|
||||
walk->markChanged();
|
||||
}
|
||||
|
||||
if (back < walk->queuePosition)
|
||||
@@ -2968,7 +2970,7 @@ void tr_torrentSetQueuePosition(tr_torrent* tor, int pos)
|
||||
}
|
||||
|
||||
tor->queuePosition = std::min(pos, back + 1);
|
||||
tor->anyDate = now;
|
||||
tor->markChanged();
|
||||
|
||||
TR_ASSERT(queueIsSequenced(tor->session));
|
||||
}
|
||||
@@ -3028,8 +3030,8 @@ static void torrentSetQueued(tr_torrent* tor, bool queued)
|
||||
if (tr_torrentIsQueued(tor) != queued)
|
||||
{
|
||||
tor->isQueued = queued;
|
||||
tor->anyDate = tr_time();
|
||||
tr_torrentSetDirty(tor);
|
||||
tor->markChanged();
|
||||
tor->setDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3224,8 +3226,8 @@ static void torrentRenamePath(void* vdata)
|
||||
tor->info.name = tr_strdup(newname);
|
||||
}
|
||||
|
||||
tr_torrentMarkEdited(tor);
|
||||
tr_torrentSetDirty(tor);
|
||||
tor->markEdited();
|
||||
tor->setDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3236,7 +3238,7 @@ static void torrentRenamePath(void* vdata)
|
||||
****
|
||||
***/
|
||||
|
||||
tor->anyDate = tr_time();
|
||||
tor->markChanged();
|
||||
|
||||
/* callback */
|
||||
if (data->callback != nullptr)
|
||||
@@ -3299,3 +3301,13 @@ bool tr_torrentHasMetadata(tr_torrent const* tor)
|
||||
{
|
||||
return tor->info.fileCount > 0;
|
||||
}
|
||||
|
||||
void tr_torrent::markEdited()
|
||||
{
|
||||
this->editDate = tr_time();
|
||||
}
|
||||
|
||||
void tr_torrent::markChanged()
|
||||
{
|
||||
this->anyDate = tr_time();
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#error only libtransmission should #include this header.
|
||||
#endif
|
||||
|
||||
#include <ctime>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
@@ -33,6 +34,7 @@
|
||||
#include "tr-macros.h"
|
||||
|
||||
class tr_swarm;
|
||||
struct tr_error;
|
||||
struct tr_magnet_info;
|
||||
struct tr_metainfo_parsed;
|
||||
struct tr_session;
|
||||
@@ -430,7 +432,7 @@ public:
|
||||
}
|
||||
|
||||
bool const checked = checkPiece(piece);
|
||||
this->anyDate = tr_time();
|
||||
this->markChanged();
|
||||
this->setDirty();
|
||||
|
||||
checked_pieces_.set(piece, checked);
|
||||
@@ -612,6 +614,9 @@ public:
|
||||
this->isDirty = true;
|
||||
}
|
||||
|
||||
void markEdited();
|
||||
void markChanged();
|
||||
|
||||
uint16_t maxConnectedPeers = TR_DEFAULT_PEER_LIMIT_TORRENT;
|
||||
|
||||
tr_verify_state verifyState = TR_VERIFY_NONE;
|
||||
@@ -673,23 +678,6 @@ constexpr bool tr_isTorrent(tr_torrent const* tor)
|
||||
return tor != nullptr && tor->magicNumber == tr_torrent::MagicNumber && tr_isSession(tor->session);
|
||||
}
|
||||
|
||||
/* set a flag indicating that the torrent's .resume file
|
||||
* needs to be saved when the torrent is closed */
|
||||
constexpr void tr_torrentSetDirty(tr_torrent* tor)
|
||||
{
|
||||
TR_ASSERT(tr_isTorrent(tor));
|
||||
|
||||
tor->isDirty = true;
|
||||
}
|
||||
|
||||
/* note that the torrent's tr_info just changed */
|
||||
static inline void tr_torrentMarkEdited(tr_torrent* tor)
|
||||
{
|
||||
TR_ASSERT(tr_isTorrent(tor));
|
||||
|
||||
tor->editDate = tr_time();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell the tr_torrent that it's gotten a block
|
||||
*/
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
#include <cstdio>
|
||||
#include <cstdlib> /* atoi() */
|
||||
#include <cstring> /* memcpy(), memset(), memchr(), strlen() */
|
||||
#include <ctime>
|
||||
#include <string_view>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <inttypes.h>
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tr-macros.h"
|
||||
|
||||
/**
|
||||
* @addtogroup utils Utilities
|
||||
* @{
|
||||
|
||||
@@ -53,7 +53,6 @@ using in_port_t = uint16_t; /* all missing */
|
||||
#include "tr-assert.h"
|
||||
#include "tr-lpd.h"
|
||||
#include "utils.h"
|
||||
#include "version.h"
|
||||
|
||||
#define SIZEOF_HASH_STRING (sizeof(((struct tr_info*)0)->hashString))
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ THE SOFTWARE.
|
||||
#include "crypto-utils.h" /* tr_rand_int_weak() */
|
||||
#include "peer-mgr.h"
|
||||
#include "peer-socket.h"
|
||||
#include "tr-assert.h"
|
||||
#include "tr-utp.h"
|
||||
#include "utils.h"
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@ THE SOFTWARE.
|
||||
#error only libtransmission should #include this header.
|
||||
#endif
|
||||
|
||||
#include <cstddef> // size_t
|
||||
|
||||
int tr_utpPacket(unsigned char const* buf, size_t buflen, struct sockaddr const* from, socklen_t fromlen, tr_session* ss);
|
||||
|
||||
void tr_utpClose(tr_session*);
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
#include <shellapi.h> /* CommandLineToArgv() */
|
||||
#include <shlwapi.h> /* StrStrIA() */
|
||||
#else
|
||||
#include <ctime>
|
||||
#include <unistd.h> /* getpagesize() */
|
||||
#endif
|
||||
|
||||
@@ -66,7 +65,6 @@
|
||||
#include "tr-assert.h"
|
||||
#include "utils.h"
|
||||
#include "variant.h"
|
||||
#include "version.h"
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
|
||||
@@ -480,6 +480,28 @@ char* tr_formatter_size_B(char* buf, uint64_t bytes, size_t buflen);
|
||||
|
||||
void tr_formatter_get_units(void* dict);
|
||||
|
||||
static inline unsigned int tr_toSpeedBytes(unsigned int KBps)
|
||||
{
|
||||
return KBps * tr_speed_K;
|
||||
}
|
||||
|
||||
static inline double tr_toSpeedKBps(unsigned int Bps)
|
||||
{
|
||||
return Bps / (double)tr_speed_K;
|
||||
}
|
||||
|
||||
static inline uint64_t tr_toMemBytes(unsigned int MB)
|
||||
{
|
||||
uint64_t B = (uint64_t)tr_mem_K * tr_mem_K;
|
||||
B *= MB;
|
||||
return B;
|
||||
}
|
||||
|
||||
static inline int tr_toMemMB(uint64_t B)
|
||||
{
|
||||
return (int)(B / (tr_mem_K * tr_mem_K));
|
||||
}
|
||||
|
||||
/***
|
||||
****
|
||||
***/
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <array>
|
||||
#include <cstdlib>
|
||||
#include <cctype> /* isdigit() */
|
||||
#include <deque>
|
||||
|
||||
@@ -8,11 +8,12 @@
|
||||
|
||||
#include <array>
|
||||
#include <cctype>
|
||||
#include <deque>
|
||||
#include <cerrno> /* EILSEQ, EINVAL */
|
||||
#include <cmath> /* fabs() */
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <deque>
|
||||
#include <string_view>
|
||||
|
||||
#include <utf8.h>
|
||||
#include <event2/buffer.h> /* evbuffer_add() */
|
||||
|
||||
@@ -17,9 +17,10 @@
|
||||
|
||||
#include <algorithm> // std::sort
|
||||
#include <cerrno>
|
||||
#include <stack>
|
||||
#include <cstdlib> /* strtod() */
|
||||
#include <cstring>
|
||||
#include <stack>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
#include <cstddef> // size_t
|
||||
#include <inttypes.h> // int64_t
|
||||
#include <string_view>
|
||||
|
||||
#include "tr-macros.h"
|
||||
#include "quark.h"
|
||||
|
||||
struct evbuffer;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <algorithm>
|
||||
#include <cstdlib> /* free() */
|
||||
#include <cstring> /* memcmp() */
|
||||
#include <ctime>
|
||||
#include <mutex>
|
||||
#include <set>
|
||||
|
||||
@@ -105,11 +106,11 @@ static bool verifyTorrent(tr_torrent* tor, bool* stopFlag)
|
||||
changed |= hasPiece != hadPiece;
|
||||
}
|
||||
|
||||
time_t const now = tr_time();
|
||||
tor->anyDate = now;
|
||||
tor->markChanged();
|
||||
|
||||
/* sleeping even just a few msec per second goes a long
|
||||
* way towards reducing IO load... */
|
||||
time_t const now = tr_time();
|
||||
if (lastSleptAt != now)
|
||||
{
|
||||
lastSleptAt = now;
|
||||
@@ -232,7 +233,7 @@ static void verifyThreadFunc(void* /*user_data*/)
|
||||
|
||||
if (!stopCurrent && changed)
|
||||
{
|
||||
tr_torrentSetDirty(tor);
|
||||
tor->setDirty();
|
||||
}
|
||||
|
||||
if (currentNode.callback_func != nullptr)
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
*/
|
||||
|
||||
#include <cstring> /* strcmp() */
|
||||
#include <string_view>
|
||||
#include <unordered_set>
|
||||
|
||||
#include <event2/event.h>
|
||||
#include <event2/util.h>
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
|
||||
#include <string_view>
|
||||
|
||||
#include "tr-macros.h"
|
||||
|
||||
struct event_base;
|
||||
|
||||
using tr_watchdir_t = struct tr_watchdir*;
|
||||
|
||||
@@ -8,13 +8,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <optional>
|
||||
#include <string_view>
|
||||
|
||||
struct evbuffer;
|
||||
|
||||
#include "transmission.h" // tr_sha1_digest_t
|
||||
#include "tr-macros.h" // tr_sha1_digest_t
|
||||
|
||||
/** @brief convenience function to determine if an address is an IP address (IPv4 or IPv6) */
|
||||
bool tr_addressIsIP(char const* address);
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <algorithm>
|
||||
#include <cstring> /* strlen(), strstr() */
|
||||
#include <set>
|
||||
#include <string_view>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <algorithm>
|
||||
#include <cstring> /* strlen() */
|
||||
#include <set>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include <event2/buffer.h>
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "transmission.h"
|
||||
|
||||
#include "announce-list.h"
|
||||
#include "error.h"
|
||||
#include "metainfo.h"
|
||||
#include "utils.h"
|
||||
#include "variant.h"
|
||||
|
||||
@@ -6,7 +6,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <array>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
|
||||
#include "transmission.h"
|
||||
|
||||
#include "crypto.h"
|
||||
#include "crypto-utils.h"
|
||||
#include "utils.h"
|
||||
@@ -15,11 +21,6 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include <array>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
TEST(Crypto, torrentHash)
|
||||
@@ -178,6 +179,23 @@ TEST(Crypto, ssha1)
|
||||
EXPECT_TRUE(tr_ssha1_matches("{d209a21d3bc4f8fc4f8faf347e69f3def597eb170pySy4ai1ZPMjeU1", "test"));
|
||||
}
|
||||
|
||||
TEST(Crypto, hex)
|
||||
{
|
||||
auto constexpr Hex = std::array<std::string_view, 2>{
|
||||
"a94a8fe5ccb19ba61c4c0873d391e987982fbbd3"sv,
|
||||
"d209a21d3bc4f8fc4f8faf347e69f3def597eb17"sv,
|
||||
};
|
||||
|
||||
for (auto const& hex : Hex)
|
||||
{
|
||||
auto digest = tr_sha1_digest_t{};
|
||||
tr_hex_to_sha1(std::data(digest), std::data(hex));
|
||||
auto hex2 = std::array<char, TR_SHA1_DIGEST_LEN * 2 + 1>{};
|
||||
tr_sha1_to_hex(std::data(hex2), std::data(digest));
|
||||
EXPECT_EQ(hex, std::data(hex2));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(Crypto, random)
|
||||
{
|
||||
/* test that tr_rand_int() stays in-bounds */
|
||||
|
||||
@@ -6,18 +6,20 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include <event2/buffer.h>
|
||||
|
||||
#include "transmission.h"
|
||||
|
||||
#include "cache.h" // tr_cacheWriteBlock()
|
||||
#include "file.h" // tr_sys_path_*()
|
||||
#include "utils.h"
|
||||
#include "variant.h"
|
||||
|
||||
#include "test-fixtures.h"
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
namespace libtransmission
|
||||
{
|
||||
|
||||
|
||||
@@ -8,23 +8,24 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdlib> // getenv()
|
||||
#include <cstring> // strlen()
|
||||
#include <memory>
|
||||
#include <mutex> // std::once_flag()
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
#include "crypto-utils.h" // tr_base64_decode_str()
|
||||
#include "error.h"
|
||||
#include "file.h" // tr_sys_file_*()
|
||||
#include "quark.h"
|
||||
#include "platform.h" // TR_PATH_DELIMITER
|
||||
#include "trevent.h" // tr_amInEventThread()
|
||||
#include "quark.h"
|
||||
#include "torrent.h"
|
||||
#include "trevent.h" // tr_amInEventThread()
|
||||
#include "utils.h"
|
||||
#include "variant.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <cstring> // strlen()
|
||||
#include <memory>
|
||||
#include <thread>
|
||||
#include <mutex> // std::once_flag()
|
||||
#include <string>
|
||||
#include <cstdlib> // getenv()
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace libtransmission
|
||||
|
||||
Reference in New Issue
Block a user