about summary refs log tree commit diff
path: root/src/libstd/sys_common/net.rs
AgeCommit message (Collapse)AuthorLines
2019-03-31libstd: deny(elided_lifetimes_in_paths)Mazdak Farrokhzad-3/+3
2019-03-16Add peer_addr function to UdpSocketLinus Unnebäck-0/+6
2019-03-09Use lifetime contravariance to elide more lifetimes in core+alloc+stdScott McMurray-1/+1
2019-02-28libstd => 2018Taiki Endo-19/+20
2019-02-13Add vectored read and write supportSteven Fackler-1/+9
This functionality has lived for a while in the tokio ecosystem, where it can improve performance by minimizing copies.
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-06Refactor net::each_addr/lookup_host to forward error from resolveJethro Beekman-16/+58
2018-09-15Improve output if no_lookup_host_duplicates failsPhilip Munksgaard-2/+3
If the test fails, output the offending addresses and a helpful error message. Also slightly improve legibility of the preceding line that puts the addresses into a HashMap.
2018-01-16Only link res_init() on GNU/*nixRyan Cumming-21/+3
To workaround a bug in glibc <= 2.26 lookup_host() calls res_init() based on the glibc version detected at runtime. While this avoids calling res_init() on platforms where it's not required we will still end up linking against the symbol. This causes an issue on macOS where res_init() is implemented in a separate library (libresolv.9.dylib) from the main libc. While this is harmless for standalone programs it becomes a problem if Rust code is statically linked against another program. If the linked program doesn't already specify -lresolv it will cause the link to fail. This is captured in issue #46797 Fix this by hooking in to the glibc workaround in `cvt_gai` and only activating it for the "gnu" environment on Unix This should include all glibc platforms while excluding musl, windows-gnu, macOS, FreeBSD, etc. This has the side benefit of removing the #[cfg] in sys_common; only unix.rs has code related to the workaround now.
2017-12-09Use Try syntax for Option in place of macros or matchMatt Brubeck-4/+1
2017-10-05replace libc::res_init with res_init_if_glibc_before_2_26Jack O'Connor-4/+9
The previous workaround for gibc's res_init bug is not thread-safe on other implementations of libc, and it can cause crashes. Use a runtime check to make sure we only call res_init when we need to, which is also when it's safe. See https://github.com/rust-lang/rust/issues/43592.
2017-09-08Re-enable networking module fo rL4ReSebastian Humenda-4/+4
As suggested in the discussion of PR #43972, std should provide a uniform API to all platforms. Since there's no networking on L4Re, this now is a module in `sys::net` providing types and functions/methods returning an error for each action.
2017-08-07addrinfo hint in lookup_host() needs clean initialization on all platformsDanek Duvall-10/+2
Fixes #43649
2017-07-06Implement TcpStream::connect_timeoutSteven Fackler-0/+8
This breaks the "single syscall rule", but it's really annoying to hand write and is pretty foundational.
2017-06-20Add `Read::initializer`.Steven Fackler-4/+0
This is an API that allows types to indicate that they can be passed buffers of uninitialized memory which can improve performance.
2017-05-04Reload nameserver information on lookup failureJon Gjengset-3/+16
As discussed in #41570, UNIX systems often cache the contents of /etc/resolv.conf, which can cause lookup failures to persist even after a network connection becomes available. This patch modifies lookup_host to force a reload of the nameserver entries following a lookup failure. This is in line with what many C programs already do (see #41570 for details). On systems with nscd, this should not be necessary, but not all systems run nscd. Introduces an std linkage dependency on libresolv on macOS/iOS (which also makes it necessary to update run-make/tools.mk). Fixes #41570. Depends on rust-lang/libc#585.
2017-03-25Fix libc::bind call on aarch64-linux-androidMarco A L Barbosa-2/+2
2017-02-04libstd/net: Add `peek` APIs to UdpSocket and TcpStreamTyler Julian-11/+13
These methods enable socket reads without side-effects. That is, repeated calls to peek() return identical data. This is accomplished by providing the POSIX flag MSG_PEEK to the underlying socket read operations. This also moves the current implementation of recv_from out of the platform-independent sys_common and into respective sys/windows and sys/unix implementations. This allows for more platform-dependent implementations.
2016-11-01std: Move sys_common to libstd/sys_commonBrian Anderson-0/+633
Make the directory structure reflect the module structure. I've always found the existing structure confusing.