Skip to content
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

Duplicate peer socket address in torrents repository #811

Open
josecelano opened this issue Apr 24, 2024 · 0 comments
Open

Duplicate peer socket address in torrents repository #811

josecelano opened this issue Apr 24, 2024 · 0 comments
Labels
Bug Incorrect Behavior
Milestone

Comments

@josecelano
Copy link
Member

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

@josecelano josecelano added this to the v3.0.0 milestone Apr 24, 2024
@josecelano josecelano added the Bug Incorrect Behavior label Apr 24, 2024
@josecelano josecelano changed the title Duplciate peer socket address in torrents repository Duplicate peer socket address in torrents repository Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Incorrect Behavior
Projects
None yet
Development

No branches or pull requests

1 participant