maintain own ishut status

This commit is contained in:
Greg Wilkins 2011-11-16 13:12:19 +11:00
parent a8173e3d12
commit 9ac9a1d687
1 changed files with 5 additions and 5 deletions

View File

@ -44,6 +44,7 @@ public class ChannelEndPoint implements EndPoint
protected final InetSocketAddress _local; protected final InetSocketAddress _local;
protected final InetSocketAddress _remote; protected final InetSocketAddress _remote;
protected int _maxIdleTime; protected int _maxIdleTime;
private boolean _ishut;
public ChannelEndPoint(ByteChannel channel) throws IOException public ChannelEndPoint(ByteChannel channel) throws IOException
{ {
@ -126,17 +127,16 @@ public class ChannelEndPoint implements EndPoint
// System.err.println(e); // System.err.println(e);
LOG.debug(e.toString()); LOG.debug(e.toString());
LOG.ignore(e); LOG.ignore(e);
if (!_socket.isClosed())
close();
} }
finally finally
{ {
_ishut=true;
if(_socket.isOutputShutdown() && !_socket.isClosed()) if(_socket.isOutputShutdown() && !_socket.isClosed())
close(); close();
} }
} }
else else
close(); _ishut=true;
} }
} }
@ -172,7 +172,7 @@ public class ChannelEndPoint implements EndPoint
} }
finally finally
{ {
if (_socket.isInputShutdown() && !_socket.isClosed()) if ((_ishut||_socket.isInputShutdown()) && !_socket.isClosed())
close(); close();
} }
} }
@ -196,7 +196,7 @@ public class ChannelEndPoint implements EndPoint
public boolean isInputShutdown() public boolean isInputShutdown()
{ {
return !_channel.isOpen() || _socket!=null && _socket.isInputShutdown(); return !_channel.isOpen() || _ishut || _socket!=null && _socket.isInputShutdown();
} }
/* (non-Javadoc) /* (non-Javadoc)