comparePeer
fun comparePeer(lhs: TorrentPeer, rhs: TorrentPeer, external: ExternalIp, externalPort: Int, finished: Boolean): Boolean
True if lhs is a better connect candidate than rhs. This is the port of the file-local compare_peer in src/peer_list.cpp. The ordering, in priority order:
lower failcount wins;
a PeerAddress.isLocal peer wins (try LAN peers first);
smaller lastConnected wins (least-recently-tried first; 0 = never);
when finished, a peer that is not maybeUploadOnly wins (de-prioritise suspected seeds);
higher sourceRank wins (tracker > LSD > DHT > PEX);
higher BEP 40 TorrentPeer.rank wins (compared unsigned).