RE: Bug in smsc_smpp.c
"Paul Keogh" <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
>
> waiting for that. Is it coming in the near future?! Should be done
> very simple I guess.
>
Here is a patch for the infinite loop problem I reported in the SMPP
driver for review. I also added in a reconnect-attempts configuration
variable for control. This is mandated by a number of operators for
SMSC connections.
Fixing this threw up another bug; the SMPP driver attempts to
send PDUS (enquire-links, submit-sm) even if a bind response has
not been received. The bind response handler sets the conn to
SMSCCONN_ACTIVE so I think that PDUs should only be sent when
the conn status is SMSCCONN_ACTIVE.
61a62
> #define SMPP_RECONNECT_ATTEMPTS 5
107a109
> long reconnect_attempts;
126c128
< int smpp_msg_id_type, int autodetect_addr)
---
> int smpp_msg_id_type, int autodetect_addr, int
reconnect_attempts)
154a157
> smpp->reconnect_attempts = reconnect_attempts;
997a1001
> long failures = 0;
1005a1010,1016
> if (failures >= smpp->reconnect_attempts) {
> error(0, "SMPP[%s]: Exceeded number of connection retry
attempts (%ld), quitting",
> octstr_get_cstr(smpp->conn->id),
smpp->reconnect_attempts);
> smpp->conn->status = SMSCCONN_DEAD;
> break;
> }
>
1016c1027,1028
< smpp->conn->status = SMSCCONN_RECONNECTING;
---
> smpp->conn->status = SMSCCONN_RECONNECTING;
> failures++;
1042c1054
< send_enquire_link(smpp, conn, &last_enquire_sent);
---
> send_enquire_link(smpp, conn, &last_enquire_sent);
1051c1063
< send_enquire_link(smpp, conn, &last_enquire_sent);
---
> send_enquire_link(smpp, conn, &last_enquire_sent);
1063,1064c1075,1079
< error(0, "SMPP[%s]: I/O error or other error.
Re-connecting.",
< octstr_get_cstr(smpp->conn->id));
---
> error(0, "SMPP[%s]: I/O error or other error.
Re-connecting in %ld seconds.",
> octstr_get_cstr(smpp->conn->id),
smpp->reconnect_delay);
> gwthread_sleep(smpp->reconnect_delay);
> smpp->conn->status = SMSCCONN_RECONNECTING;
> failures++;
1066a1082,1083
> else
> failures = 0;
1170a1188
> long reconnect_attempts;
1219c1237,1240
<
---
> if (cfg_get_integer(&reconnect_attempts, grp,
> octstr_imm("reconnect-attempts")) == -1)
> reconnect_attempts = SMPP_RECONNECT_ATTEMPTS;
>
1286c1307
< autodetect_addr);
---
> autodetect_addr, reconnect_attempts);