node-bacstack icon indicating copy to clipboard operation
node-bacstack copied to clipboard

Read Segmentation Robustness

Open NateZimmer opened this issue 4 years ago • 0 comments

Node BACstack Version: xxx.13 / PR131

Issue: Segmentation handling could use some TLC

How it currently works: There is 1 segmentation array per instance of this library. If a segment is missed, _lastSequenceNumber can get stuck at a non-zero value and subsequent segment ACKs will NACK due to a mis-match in state. Also, if multiple segments are being received at the same time, the library can get confused

Minor fix: Reset _lastSequenceNumber based upon APDU timeout expiring on the last received segment. This avoids the library getting stuck in a bad state

Proper fix: Each segmented/fragmented response should be stored in a temporary array indexed on the following :

  • per device address (ideally w/ routing support)
    • per device invoke id / sequence number

Array should be cleaned up either on successful reassembly or APDU timeout of the first request and/or of the last valid segment

NateZimmer avatar Jul 01 '20 22:07 NateZimmer