-
Notifications
You must be signed in to change notification settings - Fork 407
Update tokio to 1.0 #781
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
Update tokio to 1.0 #781
Conversation
e6e48df
to
9fb34fe
Compare
This requires ensuring TcpStreams are set in nonblocking mode as tokio doesn't handle this for us anymore, so we adapt the public API to just accept std TcpStreams instead of an extra conversion hop. Luckily converting them is cheap.
9fb34fe
to
d6b2f0f
Compare
.github/workflows/build.yml
Outdated
with: | ||
fetch-depth: 0 |
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 error message may have been a red herring. Instead, the location of the coverage data may be different in Rust 1.45 as @valentinewallace pointed out: #774 (comment)
stream.set_nonblocking(true).unwrap(); | ||
let (reader, writer) = io::split(TcpStream::from_std(stream).unwrap()); |
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.
IIUC, the problem was that our test was using std::net::TcpStream::connect
without setting the result to non-blocking before converting it to tokio::net::TcpStream
.
Could we fix the problem by updating the test to use tokio::net::TcpStream::connect
instead? Then a conversion wouldn't be needed here nor in connect_outbound
.
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 initially gone with tokio::net::TcpStream
in the public API but then realized its much neater to do the set_nonblocking
call in Connection::new
given its pretty easy to accidentally do the same issue again, and its simpler for our users to not have to think about it than not. Given that, its fewer conversion calls to just accept an std::net::TcpStream
instead of a tokio one. It doesn't really matter, though, just pretty poor API design on Tokio's part.
6affd0b
to
bf45c98
Compare
Rustc 1.45 moved the paths to test binaries, so we need to update our CI scripts to run the correct ones under kcov. The solution to this was pointed out by Val at lightningdevkit#774 (comment)
bf45c98
to
11f5e23
Compare
Codecov Report
@@ Coverage Diff @@
## main #781 +/- ##
==========================================
- Coverage 91.29% 90.79% -0.50%
==========================================
Files 37 38 +1
Lines 22921 23168 +247
==========================================
+ Hits 20925 21036 +111
- Misses 1996 2132 +136
Continue to review full report at Codecov.
|
6a90fbb
to
32abba7
Compare
Not sure why CI had refused to run previously, but this is pretty trivial and the last commit is completely trivial. Going to merge. |
This requires ensuring TcpStreams are set in nonblocking mode as
tokio doesn't handle this for us anymore, so we adapt the public
API to just accept std TcpStreams instead of an extra conversion
hop. Luckily converting them is cheap.