You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Handle TLS errors instead of server aborting. #166
let incoming_tls_stream = stream!{loop{let(socket, _) = tcp.accept().await?;let stream = tls_acceptor.accept(socket).map_err(|e| {
println!("[!] Voluntary server halt due to client-connection error...");// Errors could be handled here, instead of server aborting.// Ok(None)
error(format!("TLS Error: {:?}", e))});
yield stream.await;}};
In this code-fragment is a comment, that you can handle errors, instead of aborting the server. So I tried to uncomment the Ok(None)
line and commented out the error(format!("TLS Error: {:?}", e))
line.
But then I get the following compiler error:
error[E0277]: the trait bound `Result<std::option::Option<_>,_>:From<std::io::Error>` is not satisfied
--> src/main.rs:164:31
|
164 | let incoming_tls_stream = stream! {
| _______________________________^
165 | | loop{166 | | let(socket, _) = tcp.accept().await?;167 | | let stream = tls_acceptor.accept(socket).map_err(|e| {
... |
175 | | }176 | | };
| |_____^ the trait `From<std::io::Error>` is not implemented for `Result<std::option::Option<_>, _>`
|
= help: the following implementations were found:
<Result<(), idna::uts46::Errors> asFrom<idna::uts46::Errors>>
<Result<(), ring::error::Unspecified> asFrom<ring::bssl::Result>>
<Result<miniz_oxide::MZStatus, miniz_oxide::MZError> asFrom<&miniz_oxide::StreamResult>>
<Result<miniz_oxide::MZStatus, miniz_oxide::MZError> asFrom<miniz_oxide::StreamResult>>
= note: required because of the requirements on the impl of `Into<Result<std::option::Option<_>, _>>` for `std::io::Error`
= note: this error originates in the macro `$crate::async_stream_impl::stream_inner` (in Nightly builds, run with -Z macro-backtrace for more info)
I think, it's obviously not the right way to replace error(...) against Ok(None).
Activity
djc commentedon Feb 11, 2022
Have a look at #147 for one example. I'm sorry I haven't yet had a chance to review/merge it.
ringostarr80 commentedon Feb 11, 2022
Ok, thanks. I will look at it.
ringostarr80 commentedon Feb 14, 2022
Ok, this works.
Thanks.