Interleaved Message Handling and Frame Size handling in Decrypt #14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Rework message handling.
Essentially, OpenAuto uses one Messenger between each service, but each service is running on a specific channel which is passed to messenger under enqueueReceive.
Promises are being used as Observables so when we find an interleaved frame, we're resolving a promise on a message for a different channel. Although the previous implementation worked, it didn't see well with the concept of promises.
What I have tried to implement here, is to ensure we only resolve the original message only and anything else we send back via an interleaved Frame Handler.
We probably need to look at what we do with the interleaved frame - as it needs to get back to the appropriate calling service. Perhaps we could make Messenger service aware and convert the promises to observables, so that Messenger can basically pass information directly into the appropriate Service by Channel Id rather than doing resolve()
also didn't like the Cryptor implementation that seemed to blindly read from the buffer regardless of Frame Size.
Added Frame Size handling to decrypt();