Skip to content

Commit 8eb4010

Browse files
authored
Fix receiver and sender fd in pipe based waker
Sender and receiver fd where swapped resulting in: ``` ❯ RUSTFLAGS="--cfg mio_unsupported_force_waker_pipe" cargo test --test events events_all --all-features Compiling mio v0.8.8 (/home/harald/git/mio) Finished test [unoptimized + debuginfo] target(s) in 0.35s Running tests/events.rs (target/debug/deps/events-c745c521d9f052e3) running 1 test test events_all ... FAILED failures: ---- events_all stdout ---- thread 'events_all' panicked at 'unable to wake: Os { code: 9, kind: Uncategorized, message: "Bad file descriptor" }', tests/events.rs:30:18 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace failures: events_all test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 1 filtered out; finished in 0.00s error: test failed, to rerun pass `--test events` ``` Fixed that and added a CI test. Signed-off-by: Harald Hoyer <[email protected]>
1 parent 9f21ce1 commit 8eb4010

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@ jobs:
4343
run: cargo test --all-features
4444
- name: Tests release build
4545
run: cargo test --release --all-features
46+
TestWakerPipe:
47+
runs-on: ubuntu-latest
48+
timeout-minutes: 10
49+
env:
50+
RUSTFLAGS: "--cfg mio_unsupported_force_waker_pipe"
51+
steps:
52+
- uses: actions/checkout@v3
53+
- uses: dtolnay/rust-toolchain@stable
54+
- name: Tests
55+
run: cargo test --all-features
56+
- name: Tests release build
57+
run: cargo test --release --all-features
4658
MinimalVersions:
4759
runs-on: ${{ matrix.os }}
4860
timeout-minutes: 10

src/sys/unix/waker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ mod pipe {
224224

225225
impl WakerInternal {
226226
pub fn new() -> io::Result<WakerInternal> {
227-
let [sender, receiver] = pipe::new_raw()?;
227+
let [receiver, sender] = pipe::new_raw()?;
228228
let sender = unsafe { File::from_raw_fd(sender) };
229229
let receiver = unsafe { File::from_raw_fd(receiver) };
230230
Ok(WakerInternal { sender, receiver })

0 commit comments

Comments
 (0)