328199 Ensure blocking connectors always close socket

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2369 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2010-10-20 08:45:09 +00:00
parent 75648cc095
commit afe54ca97c
4 changed files with 29 additions and 5 deletions

View File

@ -1,3 +1,6 @@
+ 328199 Ensure blocking connectors always close socket
jetty-7.2.0.v20101020 20 October 2010
+ 289540 added javadoc into distribution
+ 297154 add source distribution artifact

View File

@ -19,7 +19,6 @@ import java.net.InetSocketAddress;
import java.net.Socket;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.log.Log;
/**
*
@ -32,7 +31,8 @@ public class SocketEndPoint extends StreamEndPoint
final Socket _socket;
final InetSocketAddress _local;
final InetSocketAddress _remote;
/* ------------------------------------------------------------ */
/**
*
*/
@ -46,6 +46,7 @@ public class SocketEndPoint extends StreamEndPoint
super.setMaxIdleTime(_socket.getSoTimeout());
}
/* ------------------------------------------------------------ */
/**
*
*/
@ -59,7 +60,8 @@ public class SocketEndPoint extends StreamEndPoint
_socket.setSoTimeout(maxIdleTime>0?maxIdleTime:0);
super.setMaxIdleTime(maxIdleTime);
}
/* ------------------------------------------------------------ */
/* (non-Javadoc)
* @see org.eclipse.io.BufferIO#isClosed()
*/
@ -69,8 +71,6 @@ public class SocketEndPoint extends StreamEndPoint
return super.isOpen() && _socket!=null && !_socket.isClosed() && !_socket.isInputShutdown() && !_socket.isOutputShutdown();
}
/* ------------------------------------------------------------ */
/*
* @see org.eclipse.jetty.io.bio.StreamEndPoint#shutdownOutput()
@ -82,6 +82,7 @@ public class SocketEndPoint extends StreamEndPoint
_socket.shutdownOutput();
}
/* ------------------------------------------------------------ */
/* (non-Javadoc)
* @see org.eclipse.io.BufferIO#close()
*/

View File

@ -266,6 +266,16 @@ public class SocketConnector extends AbstractConnector
{
_connections.remove(this);
}
// ensure it really is closed and not just shutdown.
try
{
_socket.close();
}
catch(IOException e)
{
Log.ignore(e);
}
}
}
}

View File

@ -314,6 +314,16 @@ public class BlockingChannelConnector extends AbstractNIOConnector
{
connectionClosed(_connection);
_endpoints.remove(this);
// ensure it really is closed and not just shutdown.
try
{
_socket.close();
}
catch(IOException e)
{
Log.ignore(e);
}
}
}
}