mirror of
https://github.com/transmission/transmission
synced 2025-03-04 10:38:13 +00:00
* perf: use scrape to know when a swarm is all-seeds For private torrents, the tracker is the sole source of peers. So when a private torrent's tracker responds that there are 0 leechers, we can use that information to mark the entire swarm as seeders and to not initiate connections to those peers if we are seeding. This can help seedboxes to more efficiently pick which swarms to prioritize. This strategy is not used on public torrents, since new seeder-to-seeder connections can be useful there for pex. This PR changes tr_peerMgrAddPex() to (1) remove tr_atom.seedProbability field (which was not as robust as intended) and (2) add batches of peers instead of a single peer. * fix: only use all-seeds check for private torrents
107 lines
2.3 KiB
C
107 lines
2.3 KiB
C
/*
|
|
* This file Copyright (C) 2010-2014 Mnemosyne LLC
|
|
*
|
|
* It may be used under the GNU GPL versions 2 or 3
|
|
* or any future license endorsed by Mnemosyne LLC.
|
|
*
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#ifndef __TRANSMISSION__
|
|
#error only libtransmission should #include this header.
|
|
#endif
|
|
|
|
#include "transmission.h"
|
|
|
|
struct tr_announcer;
|
|
struct tr_torrent_tiers;
|
|
|
|
/**
|
|
* *** Tracker Publish / Subscribe
|
|
* **/
|
|
|
|
typedef enum
|
|
{
|
|
TR_TRACKER_WARNING,
|
|
TR_TRACKER_ERROR,
|
|
TR_TRACKER_ERROR_CLEAR,
|
|
TR_TRACKER_PEERS,
|
|
TR_TRACKER_COUNTS,
|
|
} TrackerEventType;
|
|
|
|
struct tr_pex;
|
|
|
|
/** @brief Notification object to tell listeners about announce or scrape occurences */
|
|
typedef struct
|
|
{
|
|
/* what type of event this is */
|
|
TrackerEventType messageType;
|
|
|
|
/* for TR_TRACKER_WARNING and TR_TRACKER_ERROR */
|
|
char const* text;
|
|
char const* tracker;
|
|
|
|
/* for TR_TRACKER_PEERS */
|
|
struct tr_pex const* pex;
|
|
size_t pexCount;
|
|
|
|
/* for TR_TRACKER_PEERS and TR_TRACKER_COUNTS */
|
|
int leechers;
|
|
int seeders;
|
|
} tr_tracker_event;
|
|
|
|
typedef void (*tr_tracker_callback)(tr_torrent* tor, tr_tracker_event const* event, void* client_data);
|
|
|
|
/**
|
|
*** Session ctor/dtor
|
|
**/
|
|
|
|
void tr_announcerInit(tr_session*);
|
|
|
|
void tr_announcerClose(tr_session*);
|
|
|
|
/**
|
|
*** For torrent customers
|
|
**/
|
|
|
|
struct tr_torrent_tiers* tr_announcerAddTorrent(tr_torrent* torrent, tr_tracker_callback cb, void* cbdata);
|
|
|
|
void tr_announcerResetTorrent(struct tr_announcer*, tr_torrent*);
|
|
|
|
void tr_announcerRemoveTorrent(struct tr_announcer*, tr_torrent*);
|
|
|
|
void tr_announcerChangeMyPort(tr_torrent*);
|
|
|
|
bool tr_announcerCanManualAnnounce(tr_torrent const*);
|
|
|
|
void tr_announcerManualAnnounce(tr_torrent*);
|
|
|
|
void tr_announcerTorrentStarted(tr_torrent*);
|
|
void tr_announcerTorrentStopped(tr_torrent*);
|
|
void tr_announcerTorrentCompleted(tr_torrent*);
|
|
|
|
enum
|
|
{
|
|
TR_ANN_UP,
|
|
TR_ANN_DOWN,
|
|
TR_ANN_CORRUPT
|
|
};
|
|
|
|
void tr_announcerAddBytes(tr_torrent*, int up_down_or_corrupt, uint32_t byteCount);
|
|
|
|
time_t tr_announcerNextManualAnnounce(tr_torrent const*);
|
|
|
|
tr_tracker_stat* tr_announcerStats(tr_torrent const* torrent, int* setmeTrackerCount);
|
|
|
|
void tr_announcerStatsFree(tr_tracker_stat* trackers, int trackerCount);
|
|
|
|
/***
|
|
****
|
|
***/
|
|
|
|
void tr_tracker_udp_upkeep(tr_session* session);
|
|
|
|
void tr_tracker_udp_close(tr_session* session);
|
|
|
|
bool tr_tracker_udp_is_idle(tr_session const* session);
|