AFAICS this is unnecessary - msg will only be null if the queue is empty.

On Sunday 27 January 2008 19:49, nextgens at freenetproject.org wrote:
> Author: nextgens
> Date: 2008-01-27 19:49:59 +0000 (Sun, 27 Jan 2008)
> New Revision: 17325
> 
> Modified:
>    trunk/freenet/src/freenet/node/fcp/FCPConnectionOutputHandler.java
> Log:
> maybe fix #2019: Socket dies if first message is not ClientHello
> 
> Modified: trunk/freenet/src/freenet/node/fcp/FCPConnectionOutputHandler.java
> ===================================================================
> --- trunk/freenet/src/freenet/node/fcp/FCPConnectionOutputHandler.java        
2008-01-27 16:57:20 UTC (rev 17324)
> +++ trunk/freenet/src/freenet/node/fcp/FCPConnectionOutputHandler.java        
2008-01-27 19:49:59 UTC (rev 17325)
> @@ -44,12 +44,13 @@
>       private void realRun() throws IOException {
>               OutputStream os = new 
BufferedOutputStream(handler.sock.getOutputStream(), 4096);
>               while(true) {
> -                     boolean closed;
> +                     boolean closed, empty = false;
>                       FCPMessage msg = null;
>                       while(true) {
>                               closed = handler.isClosed();
>                               synchronized(outQueue) {
> -                                     if(outQueue.isEmpty()) {
> +                                     empty = outQueue.isEmpty();
> +                                     if(empty) {
>                                               if(closed) break;
>                                               os.flush();
>                                               try {
> @@ -64,7 +65,7 @@
>                               }
>                       }
>                       if(msg == null) {
> -                             if(closed) {
> +                             if(closed && empty) {
>                                       os.flush();
>                                       os.close();
>                                       return;
> 
> _______________________________________________
> 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: 
<https://emu.freenetproject.org/pipermail/devl/attachments/20080128/f6373611/attachment.pgp>

Reply via email to