As is my understanding, the detected peer is used once the handshake is
completed, so the address is used directly there. The official peer (the one
constructed from the physical.udp line of the reference, right?) is kept, but
since it's only used for sending handshakes to, we probably do want to do a
lookup each time we use it (taking into the account the fact that the DNS
lookups will be cached for 5 minutes anyway).
Seem okay?
Dave
On Tuesday 02 May 2006 15:49, Matthew Toseland wrote:
> Are you sure? Which peer is constructed from an IP address? The detected
> peer certainly, but we keep the official peer as well... that isn't
> often looked at?
>
> On Mon, May 01, 2006 at 09:57:14PM +0000, dbkr at freenetproject.org wrote:
> > - return _address;
> > + if (_address != null) {
> > + return _address;
> > + } else {
> > + /*
> > + * Peers are constructed from an address once
> > + * a handshake has been completed, so this
> > + * lookup will only be performed during a
> > + * handshake - it doesn't mean we perform
> > + * a DNS lookup with every packet we send.
> > + */
> > + try {
> > + return InetAddress.getByName(hostname);
> > + } catch (UnknownHostException e) {
> > + return null;
> > + }
> > + }
> > }
> --
> Matthew J Toseland - toad at amphibian.dyndns.org
> Freenet Project Official Codemonkey - http://freenetproject.org/
> ICTHUS - Nothing is impossible. Our Boss says so.
>