async-rs / async-rs/async-std

impl IntoRawFd for TcpStream closes the fd

Open
#730 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
4.1k
Forks
339
PR merge metrics
No merged PRs in 30d

Description

This code gets takes the TcpStream by value, gets its fd, and immediately destroys the TcpStream, likely destroying the fd:

```rust
impl IntoRawFd for TcpStream {
fn into_raw_fd(self) -> RawFd {
self.as_raw_fd()
}
}
```

It looks like the other impls of IntoRawFd do `self.watcher.into_inner().into_raw_fd()` which seems correct comparatively.

Contributor guide

Open the contributing guide

Research direction

Start by locating the IntoRawFd implementation for TcpStream and compare it with the other implementations that call self.watcher.into_inner().into_raw_fd(). Verify the ownership-transfer behavior and check the relevant existing tests; the issue is done when converting a TcpStream leaves the returned file descriptor valid and owned by the caller.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.