-
Notifications
You must be signed in to change notification settings - Fork 470
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
Add IPC Transport #424
Add IPC Transport #424
Conversation
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.
Thank you, looks good! Would be nice to have some docs and tests.
src/transports/ipc.rs
Outdated
}; | ||
|
||
for output in outputs { | ||
let id = match &output { |
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 could simply be let id = output.id().clone()
?
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 in 93d190f
src/transports/ipc.rs
Outdated
} | ||
} | ||
} | ||
Err(err) => log::warn!("Got bad IPC response bytes: {:?}", err), |
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.
Should it really be a warn
? What if we simply didn't get a full response yet (but it does have }
or ]
)?
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.
Nice catch
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 in 6a28cad
src/transports/ipc.rs
Outdated
let value = match helpers::to_result_from_output(output) { | ||
Ok(value) => value, | ||
Err(err) => { | ||
log::warn!("Unable to parse output into rpc::Value: {:?}", err); | ||
continue; | ||
}, |
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.
If you extract to a function this would become
let value = match helpers::to_result_from_output(output) { | |
Ok(value) => value, | |
Err(err) => { | |
log::warn!("Unable to parse output into rpc::Value: {:?}", err); | |
continue; | |
}, | |
let value = helpers::to_result_from_output(output) | |
.map_err(|err| log::warn!("Unable to parse output into rpc::Value: {:?}", err))?; |
which imho looks much nicer
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 in 7f34638
src/transports/ipc.rs
Outdated
}, | ||
Some(Err(err)) => { | ||
log::error!("IPC read error: {:?}", err); | ||
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.
Should this be return Err(...)
instead?
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 in e3d3469
src/transports/ipc.rs
Outdated
log::error!("IPC read error: {:?}", err); | ||
break; | ||
}, | ||
None => 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.
I'd change this to return Ok(())
and make the whole loop
the last statement in the function.
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 in e3d3469
src/transports/ipc.rs
Outdated
|
||
loop { | ||
tokio::select! { | ||
message = messages_rx.next() => match message { |
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.
The match
here could be if let Some(message) = message {...}
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 in 1788be6
a57a6bf
to
05b0b5e
Compare
@tomusdrw Thanks for the review! We're finishing up with the doc and tests, along with adding all the cfg flags. Then we'll take a look at your comments (and remove the draft flag). Be right back! |
Co-authored-by: lsunsi <sunsi.lucas@gmail.com>
05b0b5e
to
1788be6
Compare
@tomusdrw Done deal! All comments replied. We sent fixups in order to make your re-review easier, but we'll squash all commits into one if everything is fine. Just let us 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.
Looks perfect, thank you so much! I squash PR commits before merge anyway, so need to squash manually.
Regarding this issue: #415
This PR does not close it yet, because it doesn't add the duplex and batch transports.
But it's a start.