Bugfix: BaseChatMesh has inconsistent use of multi-byte paths#2044
Open
jourdant wants to merge 3 commits intomeshcore-dev:devfrom
Open
Bugfix: BaseChatMesh has inconsistent use of multi-byte paths#2044jourdant wants to merge 3 commits intomeshcore-dev:devfrom
jourdant wants to merge 3 commits intomeshcore-dev:devfrom
Conversation
…ses of BaseChatMesh to support multi-byte paths
Author
|
If there is interest in generalising the helper function across the codebase (IE, for classes that don't use the BaseChatMesh class such as repeater/room/sensor), I can add another commit to this PR to standardise it all. |
This file contains hidden or 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
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.
I submitted another PR (#2035) to fix a bug with auto-adverts not being published with multi-byte paths on repeaters and room servers. My original PR setup was bad, so @ripplebiz applied the patch directly to dev branch instead.
There was some code left behind in the PR that wasn't merged related to classes inheriting
BaseChatMesh(Companion, Simple Secure Chat etc). The base functionsendFloodScopedwas defaulting to a single byte path. If this function was not overridden by subclasses, then the behaviour would persist unknowingly into those classes. In this case, only Simple Secure Chat was affected, Companion had overridden the behaviour but had thepath_hash_mode + 1convention mentioned in 5 places.This PR introduces a new virtual helper function
getPathHashSize()in theBaseChatMeshclass so that all subclasses have to properly implement the multi-byte support. I have updated the subclasses to be in-line with this approach too. Hopefully it prevents any future bugs by obscurity and standardises the implementation for future subclasses too.I'm open to commentary from community/reviewers on whether this
getPathHashSize()function makes sense to be in all the firmwares, because there are 7 occurences of thepath_hash_mode + 1function being used elsewhere. At least building out the helper function reduces the risk of not being consistent across the codebase when future changes happen. Thoughts?