Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
read: clear buffer when full and invalid
If for some reason the read buffer got filled with data, but no complete hdlc frame was present, the library would get stuck. This is because the buffer is only ever erased from in the good case scenario. As a very simple workaround, albeit not a great one, just drop the entire buffer if it is not possible to deframe the data it contains _and_ it doesn't have room left for more data. Ideally, the recovery mechanism would only drop bytes until a start byte is spotted to make it more graceful on a buffer containing a partial frame. This is, however, already an edge case (otherwise users of the library should be experiencing these lockups at the moment), and thus it seems reasonable to just go for a harsh but simple workaround.
- Loading branch information