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

Matthew Toseland toad at amphibian.dyndns.org
Fri Dec 21 14:33:19 UTC 2007


Ouch ... does that mean we always timeout?! In fact, surely the below will NPE 
if sender == null?

On Thursday 20 December 2007 20:17, robert at freenetproject.org wrote:
> Author: robert
> Date: 2007-12-20 20:17:52 +0000 (Thu, 20 Dec 2007)
> New Revision: 16754
> 
> Modified:
>    trunk/freenet/src/freenet/node/InsertHandler.java
> Log:
> send positive transfer notice if we are the end of the chain
> 
> 
> Modified: trunk/freenet/src/freenet/node/InsertHandler.java
> ===================================================================
> --- trunk/freenet/src/freenet/node/InsertHandler.java	2007-12-20 20:03:35 
UTC (rev 16753)
> +++ trunk/freenet/src/freenet/node/InsertHandler.java	2007-12-20 20:17:52 
UTC (rev 16754)
> @@ -319,7 +319,10 @@
>          	sentCompletion = true;
>          }
>          
> +		Message m=null;
> +		
>          if((sender != null) && (!sentCompletionWasSet)) {
> +			//If there are downstream senders, our final success report depends on 
there being no timeouts in the chain.
>          	while(true) {
>          		synchronized(sender) {
>          			if(sender.completed()) {
> @@ -333,16 +336,23 @@
>          		}
>          	}
>          	boolean failed = sender.anyTransfersFailed();
> -        	Message m = DMT.createFNPInsertTransfersCompleted(uid, failed);
> +        	m = DMT.createFNPInsertTransfersCompleted(uid, failed);
> +		}
> +		
> +		if((sender == null) && (!sentCompletionWasSet) && (canCommit)) {
> +			//There are no downstream senders, but we stored the data locally, 
report successful transfer.
> +			//Note that this is done even if the verify fails.
> +			m = DMT.createFNPInsertTransfersCompleted(uid, false /* no timeouts */);
> +		}		
> +		
>          	try {
>          		source.sendSync(m, this);
> -        		if(logMINOR) Logger.minor(this, "Sent completion: "+failed+" 
for "+this);
> +        		if(logMINOR) Logger.minor(this, "Sent completion: "+m+" 
for "+this);
>          	} catch (NotConnectedException e1) {
>          		if(logMINOR) Logger.minor(this, "Not connected: "+source+" 
for "+this);
>          		// May need to commit anyway...
>          	}
> -        }
> -        
> +		        
>          if(code != CHKInsertSender.TIMED_OUT && code != 
CHKInsertSender.GENERATED_REJECTED_OVERLOAD && 
>          		code != CHKInsertSender.INTERNAL_ERROR && code != 
CHKInsertSender.ROUTE_REALLY_NOT_FOUND &&
>          		code != CHKInsertSender.RECEIVE_FAILED && !receiveFailed()) {
> @@ -383,7 +393,7 @@
>                  toSend = DMT.createFNPDataInsertRejected(uid, 
DMT.DATA_INSERT_REJECTED_VERIFY_FAILED);
>              } catch (AbortedException e) {
>              	Logger.error(this, "Receive failed: "+e);
> -            	// Receiver thread will handle below
> +            	// Receiver thread (below) will handle sending the failure 
notice
>              }
>          }
>          if(toSend != null) {
> 
> _______________________________________________
> cvs mailing list
> cvs at freenetproject.org
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
> 
> 
-------------- 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/20071221/f13d3eb5/attachment.pgp 


More information about the Devl mailing list