Skip to content

Add checks in from_std to ensure that it is non-blocking  #3539

Closed
@kmod-midori

Description

@kmod-midori

Is your feature request related to a problem? Please describe.
Multiple users (including me) have fallen in to this trap. Getting a UdpSocket from some other libraries and forget to set it as non-blocking can hang the runtime in a way that is not easy to debug (especially for beginners).

Describe the solution you'd like
Some checks that ensures that the socket being passed in is indeed non-blocking. This is doable in Linux with fnctl, but I'm not sure about the status on Windows.

Such check can be designed so that it only preforms in debug mode, as extra syscalls are usually involved.

Ideally, this should trigger a panic if the check fails, but an error is better than nothing.

Metadata

Metadata

Assignees

Labels

A-tokioArea: The main tokio crateC-feature-requestCategory: A feature request.M-netModule: tokio/net

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions