Closed
Conversation
That was a weird name. I think it was originally meant to be something else, then I did search and replace in this file and it change it to that name.
This will help us in tests in the upcoming commits.
daemon.Service.ListGateways used to copy each gateway by dereferencing a pointer and then returning a new slice with all gateways. This was done to protect from callsites mutating the original slice with gateways without obtaining a lock on daemon.Service.mu. However, methods such as `daemon.Service.CreateGateway` still returned a pointer to the gateway, technically allowing other callsites to modify the gateway without going through daemon.Service methods. Since in the previous commit we added a mutex to gateway.Gateway, we can no longer copy the struct by value. To work around this problem, we're going to return protos from daemon.Service methods which previously returned gateway pointers. Callsites that use those methods don't need real gateways anyway, they just need to read a couple of fields from them to return a response from the API endpoint.
dca5ae6 to
479d772
Compare
Member
Author
|
The mutex was initially added in #18259 to guard the certs when calling
Ultimately, at that stage the mutex was something nice to have rather than something which would actually prevent bugs in the code – any operations on the list of gateways are protected by a mutex on the daemon level anyway. I'm going to close this PR for now. |
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.
No description provided.