Opened 8 years ago

Closed 8 years ago

#2925 closed bug (Invalid)

Wrong peer_id after upgrade

Reported by: Len Sorensen 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 Len Sorensen 8 years ago.
Patch to fix peer_id when upgrading

Download all attachments as: .zip

Change History (8)

by Len Sorensen, 8 years ago

Attachment: deluge.patch added

Patch to fix peer_id when upgrading

comment:1 by Len Sorensen, 8 years ago

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 by Calum, 8 years ago

Component: UnknownCore
Milestone: needs verified1.3.14
Version: other (please specify)1.3.13

comment:3 by Calum, 8 years ago

What version libtorrent are you using?

comment:4 by Len Sorensen, 8 years ago

Currently 1.1.1.

comment:5 by Len Sorensen, 8 years ago

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

comment:6 by Calum, 8 years ago

Component: Corelibtorrent

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 by Calum, 8 years ago

Milestone: 1.3.14not applicable
Resolution: Invalid
Status: newclosed

This will be fixed in next libtorrent release.

Note: See TracTickets for help on using tickets.