Improve tracker entries handling

PR #19496.

* Add torrent entry status to represent tracker error
* Add torrent entry status to represent unreachable endpoint
* Display tracker entry next/min announce time
* Reset tracker entries when torrent is stopped
This commit is contained in:
Vladimir Golovnev 2023-09-07 08:58:13 +03:00 committed by GitHub
parent 2f94c92df9
commit 7cd2445a49
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 239 additions and 69 deletions

View file

@ -1,6 +1,6 @@
/*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2015-2022 Vladimir Golovnev <glassez@yandex.ru>
* Copyright (C) 2015-2023 Vladimir Golovnev <glassez@yandex.ru>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -31,6 +31,7 @@
#include <libtorrent/socket.hpp>
#include <QtContainerFwd>
#include <QDateTime>
#include <QHash>
#include <QString>
#include <QStringView>
@ -46,24 +47,30 @@ namespace BitTorrent
NotContacted = 1,
Working = 2,
Updating = 3,
NotWorking = 4
NotWorking = 4,
TrackerError = 5,
Unreachable = 6
};
struct EndpointStats
{
QString name {};
Status status = NotContacted;
QString message {};
int numPeers = -1;
int numSeeds = -1;
int numLeeches = -1;
int numDownloaded = -1;
QString message {};
QString name {};
QDateTime nextAnnounceTime;
QDateTime minAnnounceTime;
};
QString url {};
int tier = 0;
Status status = NotContacted;
QString message {};
QHash<Endpoint, QHash<int, EndpointStats>> stats {};
};