Hi

On 4/21/26 16:49, T.Nalbantova via dev wrote:
  Actually the issue is from Mina 2.2.3 and now I try to find how to 
fix/workaround sessionClosed to be invoked in case of TLS error, because 
sessionClosed invokes the method onDisconnect of the apache ftplet.


If you get a TLS error, an SSLException should be thrown, and at the end, it should be handled in the AbstractPollingIoProcess.read(session method:

...

} catch(Exception e) {

if((einstanceofIOException) &&

(!(einstanceofPortUnreachableException)

|| !AbstractDatagramSessionConfig.class.isAssignableFrom(config.getClass())

|| ((AbstractDatagramSessionConfig) config).isCloseOnPortUnreachable())) {

scheduleRemove(session);

}

IoFilterChain filterChain= session.getFilterChain();

filterChain.fireExceptionCaught(e);

}

}

The fireExceptionCaught method will close the session immediately:

/**

* {@inheritDoc}

*/

@Override

publicvoidfireExceptionCaught(Throwable cause) {

callNextExceptionCaught(head, session, cause);

}

privatevoidcallNextExceptionCaught(Entry entry, IoSession session, Throwable cause) {

// Notify the related future.

ConnectFuture future= (ConnectFuture) session.removeAttribute(SESSION_CREATED_FUTURE);

if(future== null) {

try{

IoFilter filter= entry.getFilter();

NextFilter nextFilter= entry.getNextFilter();

filter.exceptionCaught(nextFilter, session, cause);

} catch(Throwable e) {

LOGGER.warn("Unexpected exception from exceptionCaught handler.", e);

}

} else{

// Please note that this place is not the only place that

// calls ConnectFuture.setException().

if(!session.isClosing()) {

// Call the closeNow method only if needed

session.closeNow();

}

future.setException(cause);

}

}

I have not a running test atm, so it's from the top of my head...

Reply via email to