Commit d415e63f authored by Guus der Kinderen's avatar Guus der Kinderen Committed by Dave Cridland

OF-883: When an exception occurs, close the connection (not just the MINA session).

parent a6f3a972
......@@ -153,7 +153,7 @@ public abstract class ConnectionHandler extends IoHandlerAdapter {
@Override
public void exceptionCaught(IoSession session, Throwable cause) throws Exception {
Log.warn("Closing session due to exception: " + session, cause);
Log.warn("Closing connection due to exception in session: " + session, cause);
try {
// OF-524: Determine stream:error message.
......@@ -167,7 +167,10 @@ public abstract class ConnectionHandler extends IoHandlerAdapter {
final Connection connection = (Connection) session.getAttribute( CONNECTION );
connection.deliverRawText( error.toXML() );
} finally {
session.close( false );
final Connection connection = (Connection) session.getAttribute( CONNECTION );
if (connection != null) {
connection.close();
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment