about summary refs log tree commit diff
path: root/library/std/src/sys/windows/net.rs
AgeCommit message (Collapse)AuthorLines
2024-01-11std: begin moving platform support modules into `pal`joboet-497/+0
2023-11-22duration_subsecChris Denton-1/+1
calling `subsec_micros()` is more concise than this calculation
2023-10-13Make TCP connect() handle EINTR correctlyDenis Smirnov-5/+7
According to the POSIX standard, if connect() is interrupted by a signal that is caught while blocked waiting to establish a connection, connect() shall fail and set errno to EINTR, but the connection request shall not be aborted, and the connection shall be established asynchronously. If asynchronous connection was successfully established after EINTR and before the next connection attempt, OS returns EISCONN that was handled as an error before. This behavior is fixed now and we handle it as success. The problem affects MacOS users: Linux doesn't return EISCONN in this case, Windows connect() can not be interrupted without an old-fashoin WSACancelBlockingCall function that is not used in the library. So current solution gives connect() as OS specific implementation.
2023-10-06Remove libcChris Denton-1/+1
We don't use much libc on Windows.
2023-08-28Abstract over internal `SOCKET` typeChris Denton-16/+22
This allows `SOCKET` to be `usize` internally
2023-06-18Fix windows `Socket::connect_timeout` overflowEval EXEC-1/+1
Signed-off-by: Eval EXEC <execvy@gmail.com>
2023-05-05Use new bindingsChris Denton-2/+2
2023-05-01Inline AsInner implementationsKonrad Borowski-0/+1
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