This repository has been archived by the owner on Jun 23, 2022. It is now read-only.
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.
refactor(security): add join point to start negotiation #626
refactor(security): add join point to start negotiation #626
Changes from all commits
4890ec0
f0e6573
cc9fa1a
c007ec9
a3f715c
96d7360
5c3ce4d
6a24298
30c7467
205273c
8128c53
e7c9904
e9841b2
b836f34
2e51ddd
aac0721
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
From my point, if you want to decouple the negotiation entirely with
rpc_session
, you should remove this function and modifyrpc_session::on_recv_message
, where a session rejects the incoming requests when the negotiation is unfinished.Nevertheless, there's no joint point for recv_message as far as I see. (There's one joint point at
task_spec::on_rpc_call
, but not suitable since it targets at customization of tasks, rather than general rpc control).Maybe you can add such joint point later.
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.
Yes, I will do it in the next pull request. I split the refactor of network into 3 pull requests.
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.
Why these sentense out of 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.
this is kind of double check. the first one didn't lock the
_lock
.Because
negotiation_succeed
only transfered fromfalse
totrue
. So if it is true now, it will not change in the later. but if it isfalse
now, maybe it will change soon. So we should use lock to protect it.Why I use double check here is to be efficient
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.
OK, better to add some comments here
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.
Is
on_recv_message
in the same 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.
on_recv_message will not lock any locks. It only calls
is_negotiation_succeed
to judge whether the negotiation is succeed. if negotiation is not succeed, the received message will be ignored.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.
👍
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.
Why add '//]' here?
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//]
indicates that the _lock is used for protecting the members locates between[
and]