Ensure that if the read throws we close the EndPoint, so the connection can detect that the EndPoint is closed and act accordingly.

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2933 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Simone Bordet 2011-03-30 13:19:36 +00:00
parent d6627db6b5
commit 51f21301d6
1 changed files with 19 additions and 7 deletions

View File

@ -110,7 +110,7 @@ public class ChannelEndPoint implements EndPoint
socket.shutdownInput();
}
}
/* (non-Javadoc)
* @see org.eclipse.io.EndPoint#close()
*/
@ -123,12 +123,12 @@ public class ChannelEndPoint implements EndPoint
socket.shutdownOutput();
}
}
public boolean isOutputShutdown()
{
return _channel.isOpen() && _socket!=null && _socket.isOutputShutdown();
}
public boolean isInputShutdown()
{
return _channel.isOpen() && _socket!=null && _socket.isInputShutdown();
@ -177,20 +177,32 @@ public class ChannelEndPoint implements EndPoint
{
shutdownInput();
}
catch(IOException e)
catch(IOException x)
{
Log.ignore(e);
Log.ignore(x);
try
{
close();
}
catch(IOException e2)
catch (IOException xx)
{
Log.ignore(e2);
Log.ignore(xx);
}
}
}
}
catch (IOException x)
{
try
{
close();
}
catch (IOException xx)
{
Log.ignore(xx);
}
throw x;
}
finally
{
buffer.setPutIndex(bbuf.position());