// delegate the bind request upstream to server handler
this.server.bindRequested(sessionId, sessionConfiguration, bindRequest);
} catch (SmppProcessingException e) {
logger.warn("Bind request rejected or failed for connection [{}] with error [{}]", channelName, e.getMessage());
// create a failed bind response and send back to connection
BaseBindResp bindResponse = server.createBindResponse(bindRequest, e.getErrorCode());
this.sendResponsePdu(bindResponse);
// cancel the timer task & close connection
closeChannelAndCancelTimer();
return;
}
// if we got there then 98% "bound" -- we just need to create the
// new session and tie everything together -- cancel the bind timer
this.bindTimeoutTask.cancel();
// prepare an "OK" bind response that the session will send back once flagged as 'serverReady'
BaseBindResp preparedBindResponse = server.createBindResponse(bindRequest, SmppConstants.STATUS_OK);
try {
// create a new a new session and tie the bind response to it
server.createSession(sessionId, channel, sessionConfiguration, preparedBindResponse);
} catch (SmppProcessingException e) {
logger.warn("Bind request was approved, but createSession failed for connection [{}] with error [{}]", channelName, e.getMessage());
// create a failed bind response and send back to connection
BaseBindResp bindResponse = server.createBindResponse(bindRequest, e.getErrorCode());
this.sendResponsePdu(bindResponse);
// cancel the timer task & close connection
closeChannelAndCancelTimer();
return;
}