[freenet-dev] [freenet-cvs] r15472 - trunk/freenet/src/freenet/node

Matthew Toseland toad at amphibian.dyndns.org
Tue Oct 23 00:00:26 UTC 2007


On Monday 22 October 2007 12:28, you wrote:
> Author: nextgens
> Date: 2007-10-22 11:28:56 +0000 (Mon, 22 Oct 2007)
> New Revision: 15472
> 
> Modified:
>    trunk/freenet/src/freenet/node/FNPPacketMangler.java
> Log:
> JFK:
> 	Renew DH Exponentials once every 15mins if we aren't connected yet.

This is executed on the ticker, we should avoid the latency by regenerating 
off-thread.
> 
> Modified: trunk/freenet/src/freenet/node/FNPPacketMangler.java
> ===================================================================
> --- trunk/freenet/src/freenet/node/FNPPacketMangler.java	2007-10-22 11:22:47 
UTC (rev 15471)
> +++ trunk/freenet/src/freenet/node/FNPPacketMangler.java	2007-10-22 11:28:56 
UTC (rev 15472)
> @@ -508,8 +508,11 @@
>  	 */
>  	private void sendJFKMessage1(PeerNode pn, Peer replyTo) {
>  		if(logMINOR) Logger.minor(this, "Sending a JFK(1) message to "+pn);
> -		if(pn.jfkContext == null) // get a new DH exponents only if needed
> +		final long now = System.currentTimeMillis();
> +		if((pn.jfkContext == null) || ((pn.jfkContextLifetime + 15*60*1000) < 
now)) {
>  			pn.jfkContext = getLightDiffieHellmanContext();
> +			pn.jfkContextLifetime = now;
> +		}
>  		int offset = 0;
>  		byte[] myExponential = 
stripBigIntegerToNetworkFormat(pn.jfkContext.myExponential);
>  		byte[] nonce = new byte[NONCE_SIZE];
> @@ -538,7 +541,11 @@
>  	 */
>  	private void sendJFKMessage2(byte[] nonceInitator, byte[] hisExponential, 
PeerNode pn, Peer replyTo) {
>  		if(logMINOR) Logger.minor(this, "Sending a JFK(2) message to "+pn);
> -		pn.jfkContext = getLightDiffieHellmanContext();
> +		final long now = System.currentTimeMillis();
> +		if((pn.jfkContext == null) || ((pn.jfkContextLifetime + 15*60*1000) < 
now)) {
> +			pn.jfkContext = getLightDiffieHellmanContext();
> +			pn.jfkContextLifetime = now;
> +		}
>  		// g^r
>  		byte[] myExponential = 
stripBigIntegerToNetworkFormat(pn.jfkContext.myExponential);
>  		// Nr
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://emu.freenetproject.org/pipermail/devl/attachments/20071023/5ce0e22d/attachment.pgp 


More information about the Devl mailing list