linxGnu / gosmpp

Smpp (3.4) Client Library for Go
Apache License 2.0
152 stars 59 forks source link

Do we support inactivity timers in this library? #133

Closed bluewithanas closed 7 months ago

bluewithanas commented 8 months ago

as mentioned in the section7.2 under timer definitions, do we support inactivity timers where the session would be dropped automatically after specifying a time duration? this would be helpful in closing the passive connections automatically?

laduchesneau commented 7 months ago

Look in the settings , you'll see ReadTimeout.

This with a combination of a good EnquireLink interval should help detect stale binds.

bluewithanas commented 7 months ago

yepp! Reading timeouts and enquirelink will be helpful in detecting faulty connections. but my use case is to drop those connections that have no activity on them (no submit_sms, no DLR's, no MO's). I want those connections to drop automatically!

I will explore how I can work with these two to fit my use case!

maybe @tahseenjamal and @linxGnu can help me here :)

laduchesneau commented 7 months ago

To achieve what you are asking, I see two possibilities:

  1. Set the enquire_link to 0 and the bind will drop when no activity when the ReadTimeout is reached. But the library will retry to bind after disconnection and you'll have flapping binds.
  2. Implement a counter on your end and reset the counter every time you send or receive a PDU. When the counter reaches it limit, you call the close function on the session. This will stop the bind from automatically reconnection and not have any bind flapping

That said, this goes against the way the protocol was designed. I could see why you would need this in a Tx only situation, but when dealing in Rx or Trx and receiving DRs and MOs, like you mentioned, you would want to keep the bind up with enquire_links.

bluewithanas commented 7 months ago

ok thanks. i will try this.