-
Notifications
You must be signed in to change notification settings - Fork 811
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The calls to gRPC methods were each allocating new `ClientContext` object, then leaking them. ClientContext ownership is retained by the caller, so it's the caller's responsibility to delete them. The normal way this is done is to declare a local stack-allocated context, and pass a pointer to that. I also did a few small C++-y cleanups, such as the following: * Removed the public declaration for `SDKImpl` by making it a private internal class. Also, declare this as a struct rather than class since it had all public fields. * Removed the kPort int. It was never needed as an int, only a string. And it was only ever used in one place. The Google style guide says that data should be declared in the smallest scope possible, so declaring that at file-scope was too broad. In this case, the best solution is to just declare the grpc "target" as a string inline since it's needed in exactly one place. * Using `std::move()` to efficiently move (not copy) the string value function arguments. * Fixed formatting in .cc file to match .h file by putting the pointer asterisk adjacent to the type (this matches the .h file). I verified that all the code still compiles by running `make`, but I have not run any tests because AFAICT, there are no unit tests.
- Loading branch information
1 parent
5904de8
commit 787f57f
Showing
2 changed files
with
34 additions
and
38 deletions.
There are no files selected for viewing
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
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