Skip to content

Duplicate peer socket address in torrents repository #811

Closed
@josecelano

Description

@josecelano

I've been doing manual testing. I was adding new torrents to the live demo:

https://index.torrust-demo.com

I was using several BitTorrent clients, and at some point, I had a duplicate peer in the tracker. Actually, It's not a duplicate peer because the peer ID is different, but the peer socket address is the same.

We already knew about this potential issue.

This is the tracker response for the torrent:

{
  "info_hash": "cc7daef5908af33c28c410573dff50942cf339b0",
  "seeders": 0,
  "completed": 0,
  "leechers": 2,
  "peers": [
    {
      "peer_id": {
        "id": "0x2d4b54323338342d0000416b3165494941576e36",
        "client": "KTorrent"
      },
      "peer_addr": "2.137.90.142:6881",
      "updated": 1713901886647,
      "updated_milliseconds_ago": 1713901886647,
      "uploaded": 0,
      "downloaded": 0,
      "left": 195636,
      "event": "None"
    },
    {
      "peer_id": {
        "id": "0x2d4b54323338342d00006c446e6d70426f71634d",
        "client": "KTorrent"
      },
      "peer_addr": "2.137.90.142:6881",
      "updated": 1713900682225,
      "updated_milliseconds_ago": 1713900682225,
      "uploaded": 0,
      "downloaded": 0,
      "left": 195636,
      "event": "None"
    }
  ]
}

I don't know why the peer ID changed. Maybe KTorrent uses a different peer ID when you restart it.

The question is, should we allow this? I think it makes no sense to return two peers because other clients will connect to the same socket address. I would use the socket address instead of the peer ID as a key for the PeerList. If the peer id changes the tracker would return only the one that has announced the latest.

cc @torrust/maintainers

Metadata

Metadata

Assignees

Labels

BugIncorrect BehaviorNeeds FeedbackWhat dose the Community Think?SecurityPublicly Connected to Security

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions