-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show any multiple connections from the same IP in peer list #11918
Conversation
I haven't finished the review yet (you can still push commits) and I recall I looked into this issue myself too. The reason why there were no results from me is that I consider there is more to this issue and is non-trivial (at least for me at that time).
So in short, we need to handle |
Once again i opened a can of worms... aanyway so far i've been thinking about adding another value (connection) to |
@thalieht |
@zero77 yes... inadvertently :) |
A possible way is to create another struct and use it only in peerlistwidget.cpp, for example: struct PeerEndpoint
{
BitTorrent::PeerAddress address;
QString connectionType; // matches return type of `PeerInfo::connectionType()`
/* Off topic discussion
// I think `QString` as the return type of `PeerInfo::connectionType()` might
// be not a good choice. IMO qbt code base should have our own `enum class PeerConnectionType` defined
// and the values could be:
enum class PeerConnectionType
{
// https://www.libtorrent.org/reference-Core.html#peer_info
BT_TCP,
BT_UTP,
WebSeeds, // either `connection_type_t::web_seed` or `connection_type_t::http_seed` in libtorrent
};
*/
};
// add definitions of `operator==(PeerEndpoint, ...)` and `qHash(PeerEndpoint, ...)`
// Then in peerlistwidget.h
QHash<BitTorrent::PeerEndpoint, QStandardItem *> m_peerItems; That is my basic idea, maybe @glassez could provide some suggestion too. |
Thanks! That's a much better idea. I'll wait for @glassez input though in case he objects. |
IIRC, currently we show incorrect peer list since there can be multiple peers from the same IP and we show only one of them, isn't it?
Let's try to implement it. |
I didn't do the connection type enum thing because libtorrent types were mentioned which i'm not familiar with. |
src/base/bittorrent/peeraddress.h
Outdated
@@ -42,4 +42,15 @@ namespace BitTorrent | |||
static PeerAddress parse(const QString &address); | |||
QString toString() const; | |||
}; | |||
|
|||
struct PeerEndpoint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A possible way is to create another struct and use it only in peerlistwidget.cpp
Here is incorrect place. Seems it should be private for PeerListWidget.
4d474c8
to
902068b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have one more question. How do multiple peers from the same address differ in the peer list?
@@ -57,6 +57,25 @@ | |||
#include "propertieswidget.h" | |||
#include "uithememanager.h" | |||
|
|||
namespace BitTorrent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it really needed to declare the following under BitTorrent namespace? One can think that it is provided by qBittorrent base...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
From their port and/or connection type. |
The uniqueness of peers is now determined by their IP, port and connection type (uTP etc.) instead of just their IP
@thalieht |
The uniqueness of peers is now determined by their IP and port
instead of just their IP.
closes #11845