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

Matthew Toseland toad at amphibian.dyndns.org
Tue Dec 4 00:00:50 UTC 2007


That should probably be two commits, since the two changes are unrelated.

On Monday 03 December 2007 23:45, you wrote:
> Author: robert
> Date: 2007-12-03 23:45:38 +0000 (Mon, 03 Dec 2007)
> New Revision: 16249
> 
> Modified:
>    trunk/freenet/src/freenet/node/PeerNode.java
>    trunk/freenet/src/freenet/node/RequestHandler.java
> Log:
> Fix synchronization target, remove redundant connection check.
> 
> 
> Modified: trunk/freenet/src/freenet/node/PeerNode.java
> ===================================================================
> --- trunk/freenet/src/freenet/node/PeerNode.java	2007-12-03 23:17:43 UTC 
(rev 16248)
> +++ trunk/freenet/src/freenet/node/PeerNode.java	2007-12-03 23:45:38 UTC 
(rev 16249)
> @@ -872,8 +872,11 @@
>  	public void sendAsync(Message msg, AsyncMessageCallback cb, int 
alreadyReportedBytes, ByteCounter ctr) throws NotConnectedException {
>  		if(logMINOR)
>  			Logger.minor(this, "Sending async: " + msg + " : " + cb + " on " + 
this);
> -		if(!isConnected())
> +		if(!isConnected()) {
> +            if (cb instanceof SyncMessageCallback)
> +                Logger.error(this, "Tried to send " + msg + " but not 
connected to " + this, new Exception("debug"));
>  			throw new NotConnectedException();
> +        }
>  		addToLocalNodeSentMessagesToStatistic(msg);
>  		MessageItem item = new MessageItem(msg, cb == null ? null : new 
AsyncMessageCallback[]{cb}, alreadyReportedBytes, ctr);
>  		item.getData(this);
> @@ -1255,15 +1258,9 @@
>  	}
>  
>  	/**
> -	* Send a message, right now, on this thread, to this node.
> +	* Enqueue a message to be sent to this node and wait up to a minute for it 
to be transmitted.
>  	*/
>  	public void sendSync(Message req, ByteCounter ctr) throws 
NotConnectedException {
> -		synchronized(this) {
> -			if(!isConnected()) {
> -				Logger.error(this, "Tried to send " + req + " but not connected to " + 
this, new Exception("debug"));
> -				throw new NotConnectedException();
> -			}
> -		}
>  		SyncMessageCallback cb = new SyncMessageCallback();
>  		sendAsync(req, cb, 0, ctr);
>  		cb.waitForSend(60 * 1000);
> 
> Modified: trunk/freenet/src/freenet/node/RequestHandler.java
> ===================================================================
> --- trunk/freenet/src/freenet/node/RequestHandler.java	2007-12-03 23:17:43 
UTC (rev 16248)
> +++ trunk/freenet/src/freenet/node/RequestHandler.java	2007-12-03 23:45:38 
UTC (rev 16249)
> @@ -85,7 +85,7 @@
>              if((!finalTransferFailed) && rs != null && status != 
RequestSender.TIMED_OUT && status != 
RequestSender.GENERATED_REJECTED_OVERLOAD 
>              		&& status != RequestSender.INTERNAL_ERROR && !thrown) {
>              	int sent, rcvd;
> -            	synchronized(this) {
> +            	synchronized(bytesSync) {
>              		sent = sentBytes;
>              		rcvd = receivedBytes;
>              	}
> 
> _______________________________________________
> 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/20071204/297bb8ed/attachment.pgp 


More information about the Devl mailing list