Re: PeerInfo and PeerId

Hi Peter,

I’ve pushed changes according to our discussion.

I’ve replaced PeerInfo class with Uri class - see PeerInfo.h for more details. In the TrackerResponseParser I’m testing whether all ‘peers’ fields exist (if not, I’m not passing default values but just discard the invalid peer info - I think that a raw TrackerResponse must be at least syntactically valid). So if there are 99 valid peers and 1 invalid (e.g. missing some part, like ip), only these 99 valid will be stored. I’m not testing ‘ip’ validity, if a port is negative or greater than quint16max I set it to 0 and peer ID is set to QByteArray ('’, 20) if it’s not valid.

Feel free to post comments.

Have a nice day,

Petr

Would you like to post a relpy?


This post is a reply to:
Re: PeerInfo and PeerId
Hi Peter, I thought about PeerId being a VendorId like class (possibly a typedef for FixedSizeArray), so PeerId() will create a PeerId object internally storing a 20 bytes zero filled QByteArray. “Peer (more...)

Follow-ups:
Re: PeerInfo and PeerId
Hi Petr, The revision looks pretty good! The only thing I noted was that instead of implementing the custom function getPeerIdFromPeerInfo() we could use the new Uri::queryItemValue (const QByteArray &key) which (more...)