org/sonews/daemon/ChannelReader.java
changeset 3 2fdc9cc89502
parent 1 6fceb66e1ad7
child 15 f2293e8566f5
     1.1 --- a/org/sonews/daemon/ChannelReader.java	Fri Jun 26 16:48:50 2009 +0200
     1.2 +++ b/org/sonews/daemon/ChannelReader.java	Wed Jul 22 14:04:05 2009 +0200
     1.3 @@ -18,7 +18,6 @@
     1.4  
     1.5  package org.sonews.daemon;
     1.6  
     1.7 -import org.sonews.util.Log;
     1.8  import java.io.IOException;
     1.9  import java.nio.ByteBuffer;
    1.10  import java.nio.channels.CancelledKeyException;
    1.11 @@ -27,6 +26,7 @@
    1.12  import java.nio.channels.SocketChannel;
    1.13  import java.util.Iterator;
    1.14  import java.util.Set;
    1.15 +import org.sonews.util.Log;
    1.16  
    1.17  /**
    1.18   * A Thread task listening for OP_READ events from SocketChannels.
    1.19 @@ -162,7 +162,7 @@
    1.20      
    1.21      // Some bytes are available for reading
    1.22      if(selKey.isValid())
    1.23 -    {      
    1.24 +    {   
    1.25        // Lock the channel
    1.26        //synchronized(socketChannel)
    1.27        {
    1.28 @@ -172,7 +172,13 @@
    1.29          try 
    1.30          {
    1.31            read = socketChannel.read(buf);
    1.32 -        } 
    1.33 +        }
    1.34 +        catch(IOException ex)
    1.35 +        {
    1.36 +          // The connection was probably closed by the remote host
    1.37 +          // in a non-clean fashion
    1.38 +          Log.msg("ChannelReader.processSelectionKey(): " + ex, true);
    1.39 +        }
    1.40          catch(Exception ex) 
    1.41          {
    1.42            Log.msg("ChannelReader.processSelectionKey(): " + ex, false);