about summary refs log tree commit diff
path: root/library/std/src/sys/windows/net.rs
AgeCommit message (Collapse)AuthorLines
2023-03-06Implement read_buf for a few more typesTomasz Miąsko-8/+20
Implement read_buf for TcpStream, Stdin, StdinLock, ChildStdout, ChildStderr (and internally for AnonPipe, Handle, Socket), so that it skips buffer initialization. The other provided methods like read_to_string and read_to_end are implemented in terms of read_buf and so benefit from the optimization as well. This commit also implements read_vectored and is_read_vectored where applicable.
2022-06-23Represent SocketAddrV4 and SocketAddrV6 as Rust native encodingLinus Färnstrand-2/+2
2022-06-16Move/rename `lazy::Sync{OnceCell,Lazy}` to `sync::{Once,Lazy}Lock`Maybe Waffle-2/+2
2022-02-20use `BOOL` for `TCP_NODELAY` `setsockopt` value on WindowsChris Copeland-2/+2
This issue was found by the Wine project and mitigated there [1]. Windows' documented interface for `setsockopt` expects a `BOOL` (a `typedef` for `int`) for `TCP_NODELAY` [2]. Windows is forgiving and will accept any positive length and interpret the first byte of `*option_value` as the value, so this bug does not affect Windows itself, but does affect systems implementing Windows' interface more strictly, such as Wine. Wine was previously passing this through to the host's `setsockopt`, where, e.g., Linux requires that `option_len` be correct for the chosen option, and `TCP_NODELAY` expects an `int`. [1]: https://source.winehq.org/git/wine.git/commit/d6ea38f32dfd3edbe107a255c37e9f7f3da06ae7 [2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-setsockopt
2022-02-04Hide Repr details from io::Error, and rework `io::Error::new_const`.Thom Chiovoloni-7/+5
2022-01-25Rollup merge of #88794 - sunfishcode:sunfishcode/try-clone, r=joshtriplettMatthias Krüger-60/+2
Add a `try_clone()` function to `OwnedFd`. As suggested in #88564. This adds a `try_clone()` to `OwnedFd` by refactoring the code out of the existing `File`/`Socket` code. r? ``@joshtriplett``
2021-10-02Run the #85441 regression test on MSVC onlySimonas Kazlauskas-3/+3
On MinGW toolchains the various features (such as function sections) necessary to eliminate dead function references are disabled due to various bugs. This means that the windows sockets library will most likely remain linked to any mingw toolchain built program that also utilizes libstd. That said, I made an attempt to also enable `function-sections` and `--gc-sections` during my experiments, but the symbol references remained, sadly.
2021-10-02Only register `WSACleanup` if `WSAStartup` is actually ever calledChristiaan Dirkx-6/+11
2021-09-09Fix more Windows compilation errors.Dan Gohman-14/+1
2021-09-09Fix Windows compilation errors.Dan Gohman-1/+1
2021-09-09Add a `try_clone()` function to `OwnedFd`.Dan Gohman-46/+1
As suggested in #88564. This adds a `try_clone()` to `OwnedFd` by refactoring the code out of the existing `File`/`Socket` code.
2021-08-30clean up `c::linger` conversionibraheemdev-1/+1
2021-08-30add `TcpStream::set_linger` and `TcpStream::linger`ibraheemdev-1/+16
2021-08-19I/O safety.Dan Gohman-36/+70
Introduce `OwnedFd` and `BorrowedFd`, and the `AsFd` trait, and implementations of `AsFd`, `From<OwnedFd>` and `From<T> for OwnedFd` for relevant types, along with Windows counterparts for handles and sockets. Tracking issue: - <https://github.com/rust-lang/rust/issues/87074> RFC: - <https://github.com/rust-lang/rfcs/blob/master/text/3128-io-safety.md>
2021-05-28Refactor windows sockets impl methodsMichael-133/+172
2021-04-22Apply suggestions from reviewChristiaan Dirkx-5/+8
2021-04-22Rework `at_exit` to `cleanup`Christiaan Dirkx-5/+7
2021-04-18Rename `NotSupported` to `Unsupported`Christiaan Dirkx-1/+1
2021-04-18Add and insta-stabilize `std::io::ErrorKind::NotSupported`Christiaan Dirkx-1/+1
2021-03-21Use io::Error::new_const everywhere to avoid allocations.Mara Bos-6/+6
2020-07-27mv std libs to library/mark-0/+438