Skip to content
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

[WIP] Renew certificate fix #83

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

mykola-kobets-epam
Copy link
Contributor

No description provided.

++mNotificationID;
mLastMessage = message;
}
mCV.notify_all();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

*/
void Start()
{
mIsRunning = true;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guard with mutex

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

*/
void Close()
{
mIsRunning = false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move mIsRunning under lock

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

std::atomic_bool mIsRunning = true;
std::condition_variable_any mCV;
std::shared_mutex mMutex;
std::atomic_uint32_t mNotificationID = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for atomic

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

* Server writer controller handles server writer streams.
*/
template <typename T>
class ServerWriterController {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then it should be name something like StreamWriter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed to StreamWriter

if (mCV.wait_for(lock, cWaitTimeout, [this, lastNotificationID] {
return mNotificationID != lastNotificationID && mLastMessage.has_value();
})) {

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove empty line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

// postpone restart so it didn't block ApplyCert
mCertChangedResult = std::async(std::launch::async, [this]() {
LOG_INF() << "async in";
sleep(1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks not so good, especially with sleep 1.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably async grpc server itf might fix the problem with deferred actions with it's OnDone method.

https://grpc.io/docs/languages/cpp/callback/

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will you try?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no. Takes a lot of time to implement. Left std::async

@mykola-kobets-epam mykola-kobets-epam force-pushed the renew-cert-fix branch 3 times, most recently from f700cec to 9446a13 Compare October 4, 2024 09:27
src/iamclient/iamclient.cpp Show resolved Hide resolved
src/iamclient/iamclient.cpp Show resolved Hide resolved
@mykola-kobets-epam mykola-kobets-epam changed the title Renew certificate fix [WIP] Renew certificate fix Oct 7, 2024
Copy link

codecov bot commented Oct 7, 2024

Codecov Report

Attention: Patch coverage is 84.65608% with 29 lines in your changes missing coverage. Please review.

Project coverage is 86.95%. Comparing base (b4dbb1e) to head (55f2f74).
Report is 65 commits behind head on develop.

Files with missing lines Patch % Lines
src/iamclient/iamclient.cpp 53.57% 13 Missing ⚠️
src/iamserver/iamserver.cpp 77.27% 10 Missing ⚠️
src/iamserver/publicmessagehandler.cpp 92.00% 2 Missing ⚠️
src/iamserver/streamwriter.hpp 94.28% 2 Missing ⚠️
tests/iamserver/publicmessagehandler_test.cpp 95.55% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop      #83      +/-   ##
===========================================
- Coverage    87.61%   86.95%   -0.66%     
===========================================
  Files           43       48       +5     
  Lines         3092     4699    +1607     
  Branches       225      407     +182     
===========================================
+ Hits          2709     4086    +1377     
- Misses         383      613     +230     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

if (mCredentialListUpdated) {
LOG_DBG() << "Credential list updated: closing connection";

mRegisterNodeCtx->TryCancel();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And empty line before break

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

// postpone restart so it didn't block ApplyCert
mCertChangedResult = std::async(std::launch::async, [this]() {
LOG_INF() << "async in";
sleep(1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will you try?

@mykola-kobets-epam mykola-kobets-epam force-pushed the renew-cert-fix branch 5 times, most recently from b35f86d to 93e6dff Compare October 17, 2024 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants