-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement EXCHANGE_LIFETIME for message ID generation #8
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Added `EXCHANGE_LIFETIME` and made it very high for starters
- Documented - `newMid2()` now uses `findNextFree()`
- Fixed bug whereby we didn't register the new found message id
- Switched to using `newMid2()` in `doRequest(CoapRequestBuilder)`
deavmi
changed the title
Feature/exchange lifetime
Implement EXCHANGE_LIFETIME for message ID generation
Sep 25, 2023
- Set time to 10 milliseconds (for now)
- Start the stopwatch
- Tested
Seems like it is working - more testing needed though. |
- Added `setExchangeLifetime(Duration)` CoapClient (unittests) - Manually set the exchange lifetime
- Unset for now
- Set `EXCHANGE_LIFETIME` high enough to not reuse message IDs
- Cleaned up `newMid2()`
- Removed `newMid()`
- Removed old `rollingMid` - Renamed mutex for `mids` - Cleaned up imports
Looks good to me ✔️ |
Merging... |
Merged ✔️ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Purpose
This is to implement the
EXCHANGE_LIFETIME
mechanism which posits an upper bound on the lifetime of validity for a message ID, in which a message ID is still considered "in use" but over which it is available for re-usage. If it is "in use" then we must generate the next available free one.Todo ✍️
newMid2()
onNoNewMessages()
can perform a clean up as we might have a leaky memory moment if we just constantly reuse first entry and never clean out the others - we can make this configurable so as to also not always reallocate newStopwatch
instancesnewMid()