-
Notifications
You must be signed in to change notification settings - Fork 8
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
Support multiple listeners #12
Conversation
_request: tonic::Request<pb::systemd::UnitRequest>, | ||
) -> std::result::Result<tonic::Response<pb::systemd::UnitStatusResponse>, tonic::Status> { | ||
_request: Request<pb::systemd::UnitRequest>, | ||
) -> Result<Response<pb::systemd::UnitStatusResponse>, Status> { |
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 already much nicer; could also take it further by using tonic::Result
to omit the Status
, or even define our own type Result<T> = tonic::Result<Response<T>>
.
d27ef2c
to
9fb6e65
Compare
Signed-off-by: Alexander V. Nikolaev <[email protected]>
Signed-off-by: Alexander V. Nikolaev <[email protected]>
Signed-off-by: Alexander V. Nikolaev <[email protected]>
Signed-off-by: Alexander V. Nikolaev <[email protected]>
Signed-off-by: Alexander V. Nikolaev <[email protected]>
Signed-off-by: Alexander V. Nikolaev <[email protected]>
9fb6e65
to
c8a716f
Compare
Signed-off-by: Alexander V. Nikolaev <[email protected]>
c8a716f
to
d760e69
Compare
} | ||
|
||
async fn connect_unix_socket(endpoint: Endpoint, path: &String) -> anyhow::Result<Channel> { | ||
let mut path = Some(path.to_owned()); |
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 use the Arc
based solution here that we discussed earlier.
Ok(ch) | ||
} | ||
|
||
async fn connect_vsock_socket(endpoint: Endpoint, vs: &VsockAddr) -> anyhow::Result<Channel> { |
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.
VsockAddr
implements Copy
, could just drop the reference and the let ....to_owned()
(and use *vs
in the caller)
} | ||
} | ||
|
||
async fn connect_unix_socket(endpoint: Endpoint, path: &String) -> anyhow::Result<Channel> { |
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.
&str
instead of &String
#[derive(Clone, Debug, PartialEq)] | ||
pub enum EndpointAddress { | ||
Tcp { | ||
// IP + port (FIXME: should be SocketAddres) |
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.
Using String
has the benefit of being able to use names instead of IP-addresses.
Description
Support of multiple listeners -- UNIX domain socket, and also add possibility to add vsock support in future.
Also update tonic library to current release
Checklist
nix flake check --accept-flake-config
and it passesTesting
TBD