Skip to content

Commit

Permalink
fix: correct handling pdu requests
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeSafonov committed Jul 22, 2020
1 parent 5775834 commit 1c3830a
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,19 @@ public ResponseSmppSessionHandler(String clientId, @NotNull List<DeliveryReportC

@Override
public PduResponse firePduRequestReceived(PduRequest pduRequest) {

if (pduRequest != null) {
if (isDelivery(pduRequest)) {
return processReport(pduRequest);
}
log.debug(pduRequest.toString());
log.debug(pduRequest.toString());
if (isDelivery(pduRequest)) {
processReport(pduRequest);
}
return super.firePduRequestReceived(pduRequest);

return pduRequest.createResponse();
}

private boolean isDelivery(PduRequest pduRequest) {
return pduRequest.isRequest() && pduRequest.getClass() == DeliverSm.class;
}

private PduResponse processReport(PduRequest pduRequest) {
private void processReport(PduRequest pduRequest) {
DeliverSm dlr = (DeliverSm) pduRequest;
try {
DeliveryReport report = toReport(dlr);
Expand All @@ -59,7 +57,6 @@ private PduResponse processReport(PduRequest pduRequest) {
} catch (DeliveryReceiptException e) {
log.error(e.getMessage(), e);
}
return dlr.createResponse();
}

private DeliveryReport toReport(DeliverSm deliverSm) throws DeliveryReceiptException {
Expand Down

0 comments on commit 1c3830a

Please sign in to comment.