Opened 7 years ago

Closed 7 years ago

#2925 closed bug (Invalid)

Wrong peer_id after upgrade

Reported by: lsorense Owned by:
Priority: minor Milestone: not applicable
Component: libtorrent Version: 1.3.13
Keywords: Cc:

Description

I upgraded from 1.3.12 to 1.3.13 and found out that the peerid being set was still for 1.3.12 (-DE13C0-) rather than 1.3.13 (-DE13D0-). I tracked down why this happened and the fix is simple.

Attachments (1)

deluge.patch (1003 bytes) - added by lsorense 7 years ago.
Patch to fix peer_id when upgrading

Download all attachments as: .zip

Change History (8)

Changed 7 years ago by lsorense

Patch to fix peer_id when upgrading

comment:1 Changed 7 years ago by lsorense

So the problem simply is that the peer_id is generated before the session.state is loaded, which then replaces the peer_id with the old one from the saved session.state, which in my case was from 1.3.12, and then continued to set the user agent to 1.3.13, which then causes some picky trackers to point out that the peer_id and user agent are not in agreement.

Moving the session.state loading just before the peer_id is created solves the problem. Not sure why it is ever saved in the session.state in the first place, unless it is to allow a client to adapt an older saved session on load if going to a new format in a new client version.

comment:2 Changed 7 years ago by Cas

  • Component changed from Unknown to Core
  • Milestone changed from needs verified to 1.3.14
  • Version changed from other (please specify) to 1.3.13

comment:3 Changed 7 years ago by Cas

What version libtorrent are you using?

comment:4 Changed 7 years ago by lsorense

Currently 1.1.1.

comment:5 Changed 7 years ago by lsorense

It certainly did seem wrong to generate a peer_id and then overwrite it by loading the saved state immediately afterwards.

comment:6 Changed 7 years ago by Cas

  • Component changed from Core to libtorrent

There are some substantial change to session settings in 1.1 and this is a by-product of that. There is a new peer_fingerprint setting and it is now stored in session.state so obviously the fingerprint is overwritten upon loading.

Unfortunately your fix is not correct, since it will never load the previous session state.

I have opened an upstream libtorrent ticket:

https://github.com/arvidn/libtorrent/issues/1519

comment:7 Changed 7 years ago by Cas

  • Milestone changed from 1.3.14 to not applicable
  • Resolution set to Invalid
  • Status changed from new to closed

This will be fixed in next libtorrent release.

Note: See TracTickets for help on using tickets.