SMPP Throttling error processing:
I did the following patch to smsc/smsc_smpp.c in "case submit_sm_resp:"
section from line 1609:
change
***
if (pdu->u.submit_sm_resp.command_status == SMPP_ESME_RTHROTTLED)
time(&(smpp->throttling_err_time));
else
smpp->throttling_err_time = 0;
bb_smscconn_send_failed(smpp->conn, msg, reason, octstr_format("0x%08lx/%s",
pdu->u.submit_sm_resp.command_status,
smpp_error_to_string(pdu->u.submit_sm_resp.command_status)));
***
to
***
if (pdu->u.submit_sm_resp.command_status == SMPP_ESME_RTHROTTLED) {
time(&(smpp->throttling_err_time));
/* Put the message back into the SMPP queue */
gw_prioqueue_produce(smpp->msgs_to_send, msg);
} else {
smpp->throttling_err_time = 0;
bb_smscconn_send_failed(smpp->conn, msg, reason,
octstr_format("0x%08lx/%s", pdu->u.submit_sm_resp.command_status,
smpp_error_to_string(pdu->u.submit_sm_resp.command_status)));
}
***
and in sms.c I have changed the function sms_priority_compare() to reverse
time sorting order (for some reason it was LIFO):
if (msg1->sms.time > msg2->sms.time)
ret = -1;
else if (msg1->sms.time < msg2->sms.time)
ret = 1;
-------------- next part --------------
複合SMS部分的排序基於其sms.id
的附加比較:
int sms_priority_compare(const void *a, const void *b)
{
int ret;
Msg *msg1 = (Msg*)a, *msg2 = (Msg*)b;
gw_assert(msg_type(msg1) == sms);
gw_assert(msg_type(msg2) == sms);
if (msg1->sms.priority > msg2->sms.priority)
ret = 1;
else if (msg1->sms.priority < msg2->sms.priority)
ret = -1;
else {
if (msg1->sms.time > msg2->sms.time)
ret = -1;
else if (msg1->sms.time < msg2->sms.time)
ret = 1;
else {
if (msg1->sms.id > msg2->sms.id)
ret = -1;
else if (msg1->sms.id < msg2->sms.id)
ret = 1;
else
ret = 0;
}
}
return ret;
}