-
Notifications
You must be signed in to change notification settings - Fork 63
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
Hybrid network support #1606
Hybrid network support #1606
Conversation
a5812b4
to
69c72c7
Compare
0edd256
to
2be8331
Compare
tweak log messages
d071798
to
9725f73
Compare
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.
Good job:)
One thing that is lacking here for me, is logical splitting into functions and some code structure. For example initialization code is mixed with code for handling GSB messages and passing them to Client
pub(crate) static ref BCAST_HANDLERS: ArcMap<String, Arc<Mutex<BCastHandler>>> = Default::default(); | ||
pub(crate) static ref BCAST_SENDER: Arc<Mutex<Option<NetSender>>> = Default::default(); |
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.
Could be RwLock
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.
It's written to once, during initialization
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, that's why we could use RwLock
to grant access from multiple threads at the same time.
But we can make this later when thinking about making whole server and client multithreaded
let inner = state.inner.borrow(); | ||
inner | ||
.services | ||
.iter() | ||
.find(|&id| address.starts_with(id)) | ||
// replaces /net/<dest_node_id>/test/1 --> /public/test/1 | ||
.map(|s| address.replacen(s, net::PUBLIC_PREFIX, 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.
Maybe function on State
struct?
@nieznanysprawiciel Could you elaborate on "initialization code is mixed with code for handling GSB messages and passing them to Client"? |
- mod `codec` - cleanup / address review comments
Sorry for not responding, I see you fixed everything already. For example here you made elegant solution, that keeps initialization and handling separate: yagna/core/net/src/hybrid/service.rs Line 138 in 7f45273
When I read initialization code, I want to see, what futures we are spawning, but I don't want to see, what they are doing. On the other side, when I'm reading these handlers I want to see what they are doing, but I don't want to look for them in context of whole initialization code, because it is harder to read. This is mainly problems with inlined closures passed to |
No description provided.