-
Notifications
You must be signed in to change notification settings - Fork 4
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
base: develop
Are you sure you want to change the base?
[WIP] Renew certificate fix #83
Conversation
Signed-off-by: Mykola Kobets <[email protected]>
90423b4
to
e514390
Compare
++mNotificationID; | ||
mLastMessage = message; | ||
} | ||
mCV.notify_all(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty line
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guard with mutex
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move mIsRunning under lock
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for atomic
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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(); | ||
})) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove empty line
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will you try?
There was a problem hiding this comment.
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
f700cec
to
9446a13
Compare
9446a13
to
ff574f9
Compare
Codecov ReportAttention: Patch coverage is
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. |
if (mCredentialListUpdated) { | ||
LOG_DBG() << "Credential list updated: closing connection"; | ||
|
||
mRegisterNodeCtx->TryCancel(); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will you try?
b35f86d
to
93e6dff
Compare
Signed-off-by: Mykola Kobets <[email protected]>
Signed-off-by: Mykola Kobets <[email protected]>
Signed-off-by: Mykola Kobets <[email protected]>
93e6dff
to
55f2f74
Compare
No description provided.