Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

Destroy session in DefaultSmppClient on bind error #97

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public SmppSession bind(SmppSessionConfiguration config, SmppSessionHandler sess
// close the session if we weren't able to bind correctly
if (session != null && !session.isBound()) {
// make sure that the resources are always cleaned up
try { session.close(); } catch (Exception e) { }
try { session.destroy(); } catch (Exception e) { }
}
}
return session;
Expand Down Expand Up @@ -226,7 +226,7 @@ protected DefaultSmppSession doOpen(SmppSessionConfiguration config, SmppSession
return createSession(channel, config, sessionHandler);
}

protected DefaultSmppSession createSession(Channel channel, SmppSessionConfiguration config, SmppSessionHandler sessionHandler) throws SmppTimeoutException, SmppChannelException, InterruptedException {
protected DefaultSmppSession createSession(Channel channel, SmppSessionConfiguration config, SmppSessionHandler sessionHandler) throws SmppChannelException {
DefaultSmppSession session = new DefaultSmppSession(SmppSession.Type.CLIENT, config, channel, sessionHandler, monitorExecutor);

// add SSL handler
Expand All @@ -239,6 +239,7 @@ protected DefaultSmppSession createSession(Channel channel, SmppSessionConfigura
sslEngine.setUseClientMode(true);
channel.getPipeline().addLast(SmppChannelConstants.PIPELINE_SESSION_SSL_NAME, new SslHandler(sslEngine));
} catch (Exception e) {
session.destroy();
throw new SmppChannelConnectException("Unable to create SSL session]: " + e.getMessage(), e);
}
}
Expand Down