Hi Alexander, I prefer Alex's patch as it conforms more closely to spec I believe.
Alex I have added a couple of bits to your patch (cfg.def and docs/userguide.xml). Please double check this and vote. Cheers, Alan On Tue, 2003-08-19 at 05:10, Alexander Malysh wrote: > Hi Alex, > > sorry for the long delay... > > I have another patch here, that I would like to commit if nobody has any > ojections... Please try it, it works very well on our production systems > since 6 months or so... > > On Monday 18 August 2003 17:29, Alex Judd wrote: > > How about a quick code review and a commit of this? > > > > Not to say that discussing the email list isn't important but ... > > > > :) > > > > Alex > > > > ----- Original Message ----- > > From: "Alex Judd" <[EMAIL PROTECTED]> > > To: "Alex Judd" <[EMAIL PROTECTED]>; "Aaron Brady" > > <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > Sent: Friday, August 15, 2003 2:54 PM > > Subject: [Patch] To add timeouts to SMPP connections > > > > > I've reworked Aaron's patch to be a bit more Kannel standard and allowed > > > > for > > > > > definition of enquire-link-retry externally to the code and a standard > > > > value > > > > > of 10 per suggestions. > > > > > > It's working for me here but would be good for one of the team to once > > > > over. > > > > > Alex > > > Skywire > > > > > > ----- Original Message ----- > > > From: "Alex Judd" <[EMAIL PROTECTED]> > > > To: "Aaron Brady" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > > Sent: Friday, August 08, 2003 10:43 AM > > > Subject: Re: Patch: To add timeouts to SMPP connections > > > > > > > Aaron > > > > > > > > Seeing as I picked this up in the first place, how about I rework your > > > > > > patch > > > > > > > to be a bit more flexible and submit it back for testing. > > > > > > > > This way we get the best of both worlds? > > > > > > > > Alex > > > > > > > > ----- Original Message ----- > > > > From: "Aaron Brady" <[EMAIL PROTECTED]> > > > > To: <[EMAIL PROTECTED]> > > > > Sent: Friday, August 08, 2003 10:25 AM > > > > Subject: Re: Patch: To add timeouts to SMPP connections > > > > > > > > > > Looks good, however I'd potentially make it more configurable so > > > > that > > > > > > the > > > > > > > > > X > > > > > > > > > > > x wait is one of the default settings and can be configured should > > > > it > > > > > > need > > > > > > > > > > be. > > > > > > > > > > If it's easy enough, then I don't see why not, but I'm not altogether > > > > > familiar with the internals of Kannel, so other than using your below > > > > > > code > > > > > > > > as a starting point, I wouldn't know what to do. Personally, I think > > > > > > that > > > > > > > > given enquire_link_interval is configurable that adds enough > > > > > > flexability - > > > > > > > > this is similar to how IRC servers do things, with a configurable > > > > > > > > ping-time, > > > > > > > > > but if you miss two then you're disconnected, but if people think it > > > > > > needs > > > > > > > > the extra option then I can try and add it. > > > > > > > > > > > For example > > > > > > > > > > > > > > > > > > if (cfg_get_integer(&enquire_link_interval, grp, > > > > > > octstr_imm("enquire-link-retry")) == -1) > > > > > > enquire_link_interval = SMPP_ENQUIRE_LINK_RETRY; > > > > > > > > > > > > <other bits of code needed to map the parameter to the smpp > > > > structure> > > > > > > > > if(date_universal_now() - smpp->last_enquire_received > > > > > > > > > > > > > (smpp->enquire_link_retry * > > > > > > > > smpp->enquire_link_interval)) > > > > > > > > > { > > > > > > > > > > > etc. > > > > > > > > > > > > Also - would it make sense to send an extra send_enquire_link to > > > > make > > > > > > sure > > > > > > > > > > that the other end is not contacting? > > > > > > > > > > I think that if the connection has gotten so far as to miss three > > > > pings, > > > > > > > it's not likely to recover, and manually sending another enquire_link > > > > > > > > would > > > > > > > > > complicate the code needlessly, but again, I'm sure there are people > > > > > > more > > > > > > > > knowledgable about this than me and if they think different, then I > > > > can > > > > > > try > > > > > > > > > and implement it. > > > > > > > > > > Aaron
Index: doc/userguide/userguide.xml =================================================================== RCS file: /home/cvs/gateway/doc/userguide/userguide.xml,v retrieving revision 1.241 diff -u -r1.241 userguide.xml --- doc/userguide/userguide.xml 11 Aug 2003 20:58:29 -0000 1.241 +++ doc/userguide/userguide.xml 18 Aug 2003 21:11:12 -0000 @@ -2837,6 +2837,13 @@ active session. The default is 30 seconds. </entry></row> + <row><entry><literal>enquire-link-retry</literal></entry> + <entry><literal>number</literal></entry> + <entry valign="bottom"> + Optional the number of unanswered enquire-links that should be sent + before reconnecting to the SMSC. The default is 10. + </entry></row> + <row><entry><literal>max-pending-submits</literal></entry> <entry><literal>number</literal></entry> <entry valign="bottom"> Index: gw/smsc/smsc_smpp.c =================================================================== RCS file: /home/cvs/gateway/gw/smsc/smsc_smpp.c,v retrieving revision 1.46 diff -u -r1.46 smsc_smpp.c --- gw/smsc/smsc_smpp.c 3 Aug 2003 22:36:35 -0000 1.46 +++ gw/smsc/smsc_smpp.c 18 Aug 2003 21:11:16 -0000 @@ -50,6 +50,7 @@ */ #define SMPP_ENQUIRE_LINK_INTERVAL 30.0 +#define SMPP_ENQUIRE_LINK_RETRY 10 #define SMPP_MAX_PENDING_SUBMITS 10 #define SMPP_DEFAULT_VERSION 0x34 #define SMPP_DEFAULT_PRIORITY 0 @@ -84,6 +85,8 @@ int receive_port; int quitting; long enquire_link_interval; + long enquire_link_retry; + long last_enquire_received; long max_pending_submits; int version; int priority; /* set default priority for messages */ @@ -101,7 +104,7 @@ Octstr *address_range, int source_addr_ton, int source_addr_npi, int dest_addr_ton, int dest_addr_npi, - int enquire_link_interval, + int enquire_link_interval, int enquire_link_retry, int last_enquire_received, int max_pending_submits, int version, int priority, Octstr *my_number, int smpp_msg_id_type, int autodetect_addr, Octstr *alt_charset, @@ -132,6 +135,8 @@ smpp->transmit_port = transmit_port; smpp->receive_port = receive_port; smpp->enquire_link_interval = enquire_link_interval; + smpp->enquire_link_retry = enquire_link_retry; + smpp->last_enquire_received = 0; smpp->max_pending_submits = max_pending_submits; smpp->quitting = 0; smpp->version = version; @@ -931,6 +936,7 @@ break; case enquire_link_resp: + smpp->last_enquire_received = date_universal_now(); break; case submit_sm_resp: @@ -1171,12 +1177,19 @@ conn = open_receiver(smpp); last_enquire_sent = date_universal_now(); + smpp->last_enquire_received = date_universal_now(); pending_submits = -1; len = 0; smpp->throttling_err_time = 0; for (;conn != NULL;) { timeout = last_enquire_sent + smpp->enquire_link_interval - date_universal_now(); + if(date_universal_now() - smpp->last_enquire_received + > (smpp->enquire_link_retry * smpp->enquire_link_interval)) { + debug("bb.sms.smpp", 0, "SMSC Timeout"); + smpp->conn->status = SMSCCONN_RECONNECTING; + break; + } /* unbind * TODO: read so long as unbind_resp received. Otherwise we have @@ -1366,6 +1379,8 @@ int transceiver_mode; Octstr *smsc_id; long enquire_link_interval; + long enquire_link_retry; + long last_enquire_received; long max_pending_submits; long version; long priority; @@ -1408,6 +1423,9 @@ if (cfg_get_integer(&enquire_link_interval, grp, octstr_imm("enquire-link-interval")) == -1) enquire_link_interval = SMPP_ENQUIRE_LINK_INTERVAL; + if (cfg_get_integer(&enquire_link_retry, grp, + octstr_imm("enquire-link-retry")) == -1) + enquire_link_retry = SMPP_ENQUIRE_LINK_RETRY; if (cfg_get_integer(&max_pending_submits, grp, octstr_imm("max-pending-submits")) == -1) max_pending_submits = SMPP_MAX_PENDING_SUBMITS; @@ -1483,7 +1501,7 @@ smpp = smpp_create(conn, host, port, receive_port, system_type, username, password, address_range, source_addr_ton, source_addr_npi, dest_addr_ton, - dest_addr_npi, enquire_link_interval, + dest_addr_npi, enquire_link_interval, enquire_link_retry, last_enquire_received, max_pending_submits, version, priority, my_number, smpp_msg_id_type, autodetect_addr, alt_charset, service_type); Index: gwlib/cfg.def =================================================================== RCS file: /home/cvs/gateway/gwlib/cfg.def,v retrieving revision 1.92 diff -u -r1.92 cfg.def --- gwlib/cfg.def 8 Aug 2003 14:24:38 -0000 1.92 +++ gwlib/cfg.def 18 Aug 2003 21:11:16 -0000 @@ -268,6 +270,7 @@ OCTSTR(service-type) OCTSTR(source-addr-autodetect) OCTSTR(enquire-link-interval) + OCTSTR(enquire-link-retry) OCTSTR(max-pending-submits) OCTSTR(reconnect-delay) OCTSTR(transceiver-mode)