Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: PDU SubmitWindow with; MaxWindowSize option, ExpectedRespons…
…e handler, ExpiredPdus handler and NoRespPdu OnClose handler (#134) What: - Add a submit window via a [concurrent-map](https://github.com/orcaman/concurrent-map) that tracks Requests (SubmitSM, EnquireLinks, ReplaceSM, etc..) - Add functionality to return a expected response with the original sent PDU - Add functionality to track PDUs with no response and a timer setting for when they expire - Add a max window size setting, to limit the number of outbound request - Add function call to get current bind window size on Tx and Trx - Add function call to get a PDU stuck in the submit store when the bind closes. - Add an example on how to use new settings - Add an example on how to implemented a Custom PDU to add any fields to be tracked Why: As requested in #126, #105 and #73, the user sometimes needs to track all requests sent to SMSC. Either to relate a response to a request, or to track a request that have received no response or even to limit the number of outgoing request without any response from the SMSC. How: - The main feature, the submit window, works by using a [concurrent-map](https://github.com/orcaman/concurrent-map) as a key/value store. The key is the PDU sequence number and the value is a new Request struct created for this feature. Concurrent-map is thread safe and has all the functionality needed for this use case. The map gets reset on every rebind and all PDUs stored in the map are can be retruned to the user via a func call when the session is closed. - When the user Submits a PDU, it is stored in the new Request struct with the request is created - When the library receives a PDU from the SMSC, it will verify if the PDU is a response type (SubmitSMResp, ReplaceSMResp, etc) and queries the key/value store with the sequence number. If the store contains a PDU request, the response is returned to the user with the PDU and the original request via OnExpectedPduResponse setting. The Request is removed from the store after the lookup. - Receivable has been modified to add a new loopWithVerifyExpiredPdu, that verifies all PDU in the store and compare the time they were stored. If the time is great than the value entered by the setting PduExpireTimeOut, the PDU is removed from the store and return to the user via OnExpiredPduRequest. The submit window will only contain PDU that return true on CanResponse, except Unbind and BindRequest: - CancelSM - DataSM - DeliverSM - EnquireLink - QuerySM - ReplaceSM - SubmitMulti - SubmitSM This PR does not break current user experience, all old test pass and if user does not add the new settings, all will work as it previously did.
- Loading branch information