On Sunday 20 January 2008 16:01, zothar at freenetproject.org wrote:
> Author: zothar
> Date: 2008-01-20 16:01:53 +0000 (Sun, 20 Jan 2008)
> New Revision: 17170
> 
> Modified:
>    trunk/freenet/src/freenet/node/PeerNode.java
> Log:
> Add code, not wired in yet, to send a differential node reference containing 
node reference fields not required for handshake.  Once wired in, this should 
later allow removing those fields from the handshake exchanged node 
references.
> 
> Modified: trunk/freenet/src/freenet/node/PeerNode.java
> ===================================================================
> --- trunk/freenet/src/freenet/node/PeerNode.java      2008-01-19 23:44:16 UTC 
(rev 17169)
> +++ trunk/freenet/src/freenet/node/PeerNode.java      2008-01-20 16:01:53 UTC 
(rev 17170)
> @@ -3472,9 +3472,48 @@
>       }
>  
>       /**
> -      * A method to be to queue an N2NM in a extra peer data file, only 
implemented by DarknetPeerNode
> +      * A method to queue an N2NM in a extra peer data file, only 
> implemented 
by DarknetPeerNode
>        */
>       public void queueN2NM(SimpleFieldSet fs) {
>               // Do nothing in the default impl
>       }
> +
> +     /**
> +      * A method to be called after completing a handshake to send the
> +      * newly connected peer, as a differential node reference, the
> +      * parts of our node reference not needed for handshake.
> +      * Should only be called by completedHandshake() after we're happy
> +      * with the connection
> +      */
> +     private void sendConnectedDiffNoderef() {
> +             SimpleFieldSet fs = new SimpleFieldSet(true);
> +             SimpleFieldSet nfs = null;
> +             if(isDarknet()) {
> +                     node.exportDarknetPublicFieldSet();
> +             } else if(isOpennet()) {
> +                     node.exportOpennetPublicFieldSet();
> +             } else {
> +                     // What else is there that a differential node 
> reference would care 
about?  Add it here if needed
> +                     return;
> +             }

A seed node should also get a differential noderef, being the opennet noderef. 
Maybe you should factor this out into getLocalNoderef() or something ?

> +             if(null != nfs.get("ark.pubURI")) {
> +                     fs.putOverwrite("ark.pubURI", nfs.get("ark.pubURI"));
> +             }
> +             if(null != nfs.get("ark.number")) {
> +                     fs.putOverwrite("ark.number", nfs.get("ark.number"));
> +             }
> +             if(isDarknet() && null != nfs.get("myName")) {
> +                     fs.putOverwrite("myName", nfs.get("myName"));
> +             }
> +             String[] physicalUDPEntries = nfs.getAll("physical.udp");
> +             if(physicalUDPEntries != null) {
> +                     fs.putOverwrite("physical.udp", physicalUDPEntries);
> +             }
> +             if(!fs.isEmpty()) {
> +                     if(logMINOR) Logger.minor(this, "fs is '" + 
> fs.toString() + "'");
> +                     sendNodeToNodeMessage(fs, 
> Node.N2N_MESSAGE_TYPE_DIFFNODEREF, false, 0, 
false);
> +             } else {
> +                     if(logMINOR) Logger.minor(this, "fs is empty");
> +             }
> +     }
>  }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<https://emu.freenetproject.org/pipermail/devl/attachments/20080122/7320a28e/attachment.pgp>

Reply via email to