MYNEWT-774 Serial errors in newtmgr messages #323
Merged
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.
Using the nmgr_shell transport (newtmgr over shell), some incoming commands get dropped. The problem seems to be caused by an exhaustion of shell events. By default, the shell only allocates a single event.
The sequence looks like this:
1. Client sends newtmgr command to device.
2. Console passes newtmgr command to shell.
3. Shell allocates the only event and fills it with the data.
4. Shell processes event, hands data to newtmgr code.
5. Newtmgr processes command and sends response.
6. Client sees response and sends follow-up command.
7. Console passes newtmgr command to shell.
8. Shell has no events left; drops incoming command.
9. Initial event gets freed.
By changing the default event count from 1 to 2, we ensure there is always a spare event available. Since we will never send the second response before freeing the first event, two events is sufficient.