{"action":"created","issue":{"url":"https://api.github.com/repos/arvidn/libtorrent/issues/2792","repository_url":"https://api.github.com/repos/arvidn/libtorrent","labels_url":"https://api.github.com/repos/arvidn/libtorrent/issues/2792/labels{/name}","comments_url":"https://api.github.com/repos/arvidn/libtorrent/issues/2792/comments","events_url":"https://api.github.com/repos/arvidn/libtorrent/issues/2792/events","html_url":"https://github.com/arvidn/libtorrent/issues/2792","id":297247646,"number":2792,"title":"Duplicate peer resolution broken in the SSL mode","user":{"login":"mkatsevVR","id":911677,"avatar_url":"https://avatars2.githubusercontent.com/u/911677?v=4","gravatar_id":"","url":"https://api.github.com/users/mkatsevVR","html_url":"https://github.com/mkatsevVR","followers_url":"https://api.github.com/users/mkatsevVR/followers","following_url":"https://api.github.com/users/mkatsevVR/following{/other_user}","gists_url":"https://api.github.com/users/mkatsevVR/gists{/gist_id}","starred_url":"https://api.github.com/users/mkatsevVR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkatsevVR/subscriptions","organizations_url":"https://api.github.com/users/mkatsevVR/orgs","repos_url":"https://api.github.com/users/mkatsevVR/repos","events_url":"https://api.github.com/users/mkatsevVR/events{/privacy}","received_events_url":"https://api.github.com/users/mkatsevVR/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-02-14T21:15:09Z","updated_at":"2018-02-17T23:06:34Z","closed_at":null,"author_association":"NONE","body":"libtorrent version (or branch): 1.0.11 (although the code looks unchanged, so I suspect the same issue is present in 1.1)\r\n\r\nplatform/architecture: Linux\r\n\r\ncompiler and compiler version: gcc 5\r\n\r\nUsing the SSL mode, I've noticed a occasional (in the sense that it doesn't happen every time, but when it does happen, it persists until restart) occurrence of 2 peers being unable to maintain connection. In the logs on both sides I see this every 1 minute exactly:\r\n\r\n```\r\npeer_connect_alert: peer ([hostA]:4433, Unknown) connecting to peer (SSL/TCP)\r\nincoming_connection_alert: incoming connection from [hostA]:51599 (SSL/TCP)\r\npeer_disconnected_alert: peer ([hostA]:51599, libtorrent 1.0.0) disconnecting: [libtorrent error] duplicate peer-id\r\npeer_disconnected_alert: peer ([hostA]:4433, libtorrent 1.0.0) disconnecting: [asio.misc] End of file\r\n```\r\n\r\nMy theory is that for some reason both clients get in a loop where they retry to connect to each other every minute. The current implementation decides which connection to drop based on the remote port number, which is always the same with SSL, so both ends decide to drop the other connection at the same time thus continuing the loop. https://github.com/arvidn/libtorrent/blob/libtorrent-1_0_11/src/policy.cpp#L1017\r\n\r\nI can mitigate this by selecting the SSL listening port randomly on startup instead of using 4433 as default, but there is still a chance of 2 clients picking the same port and being unable to talk to each othe. The comment above this code explicitly mentions only using the listening port instead of outgoing one, but I don't understand why. AFAICT the fact that the outgoing port is different each time is good, since it means the conflict can only be intermittent but not permanent."},"comment":{"url":"https://api.github.com/repos/arvidn/libtorrent/issues/comments/366478142","html_url":"https://github.com/arvidn/libtorrent/issues/2792#issuecomment-366478142","issue_url":"https://api.github.com/repos/arvidn/libtorrent/issues/2792","id":366478142,"user":{"login":"arvidn","id":661450,"avatar_url":"https://avatars0.githubusercontent.com/u/661450?v=4","gravatar_id":"","url":"https://api.github.com/users/arvidn","html_url":"https://github.com/arvidn","followers_url":"https://api.github.com/users/arvidn/followers","following_url":"https://api.github.com/users/arvidn/following{/other_user}","gists_url":"https://api.github.com/users/arvidn/gists{/gist_id}","starred_url":"https://api.github.com/users/arvidn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arvidn/subscriptions","organizations_url":"https://api.github.com/users/arvidn/orgs","repos_url":"https://api.github.com/users/arvidn/repos","events_url":"https://api.github.com/users/arvidn/events{/privacy}","received_events_url":"https://api.github.com/users/arvidn/received_events","type":"User","site_admin":false},"created_at":"2018-02-17T23:06:34Z","updated_at":"2018-02-17T23:06:34Z","author_association":"OWNER","body":"here's a fix against RC_1_1 (please feel free to apply it against RC_1_0 and test it). I imagine it would apply by just changing the filename to ``policy.cpp``. https://github.com/arvidn/libtorrent/pull/2796"}}
{"actor":{"display_login":"arvidn"}}