Re: SMPP getting stuck
Nisan Bloch <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Here is a different take the Andreas's SMPP generic_nack patch. This is a bit more complete, and fixes a potential NULL pointer exception in the code. On line 922 a check is made for msg==NULL, and an error message outputed, but then bb_smscconn_send_failed is called with the NULL msg. This patch is quite different so I have attached the changed case, rather than a diff. Nisan
smsc_smpp.patch
(text/plain, 2.1 KB)
case generic_nack:
cmd_stat = pdu->u.generic_nack.command_status;
os = octstr_format("%ld", pdu->u.generic_nack.sequence_number);
msg = dict_remove(smpp->sent_msgs, os);
octstr_destroy(os);
if (msg == NULL) {
warning(0, "SMPP[%s]: SMSC sent generic_nack "
"with wrong sequence number 0x%08lx",
octstr_get_cstr(smpp->conn->id),
pdu->u.generic_nack.sequence_number);
} else {
if ((cmd_stat == SMPP_ESME_RTHROTTLED) ||
(cmd_stat == SMPP_ESME_RMSGQFUL)) {
info(0,"SMPP[%s]: SMSC sent generic_nack %s: status 0x%08lx ",
(cmd_stat==SMPP_ESME_RTHROTTLED?"ESME_RTHROTTLED":"ESME_RMSGQFUL"),
octstr_get_cstr(smpp->conn->id),pdu->u.generic_nack.command_status);
time(&(smpp->throttling_err_time));
reason = smpp_status_to_smscconn_failure_reason(
pdu->u.generic_nack.command_status);
bb_smscconn_send_failed(smpp->conn, msg, reason);
--(*pending_submits);
} if (cmd_stat == SMPP_ESME_RUNKNOWNERR) {
info(0,"SMPP[%s]: SMSC sent generic_nack SMPP_ESME_RUNKNOWNERR: status 0x%08lx ",
octstr_get_cstr(smpp->conn->id),pdu->u.generic_nack.command_status);
reason = smpp_status_to_smscconn_failure_reason(-1);
bb_smscconn_send_failed(smpp->conn, msg, reason);
--(*pending_submits);
} else {
error(0, "SMPP[%s]: SMSC sent generic_nack type 0x%08lx, code 0x%08lx.",
octstr_get_cstr(smpp->conn->id), pdu->type,
pdu->u.generic_nack.command_status);
reason = smpp_status_to_smscconn_failure_reason(-1);
bb_smscconn_send_failed(smpp->conn, msg, reason);
--(*pending_submits);
}
}
break;