Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 9 pull requests #34720

Merged
merged 19 commits into from
Jul 8, 2016
Merged

Rollup of 9 pull requests #34720

merged 19 commits into from
Jul 8, 2016

Conversation

Sam Payson and others added 12 commits June 5, 2016 10:20
The term "thread-local" has a widely-accepted meaning which is not
the meaning it's used for here.
If not, the error `does not have these features: foo` confused. 
r? @steveklabnik
- minor pronoun fix We -> You
- PATH troubleshooting
- dir output is vertical (but did not include timestamps)
- executables not in %PATH% require .\
When resolving a hostname, pass a hints struct where ai_socktype is
set to SOCK_STREAM in order to eliminate repeated results for each
protocol family.
Revise wording in Rc documentation.

The term "thread-local" has a widely accepted meaning which is not
the meaning it's used for here.
@rust-highfive
Copy link
Collaborator

r? @brson

(rust_highfive has picked a reviewer for you, use r? to override)

@Manishearth
Copy link
Member Author

@bors r+ p=10

@bors
Copy link
Contributor

bors commented Jul 8, 2016

📌 Commit fe7dc33 has been approved by Manishearth

@bors
Copy link
Contributor

bors commented Jul 8, 2016

⌛ Testing commit fe7dc33 with merge d8a65cd...

bors added a commit that referenced this pull request Jul 8, 2016
Rollup of 9 pull requests

- Successful merges: #34097, #34456, #34610, #34612, #34659, #34688, #34691, #34699, #34700
- Failed merges:
@bors
Copy link
Contributor

bors commented Jul 8, 2016

💔 Test failed - auto-win-gnu-64-opt

@Manishearth
Copy link
Member Author

@bors r+

@bors
Copy link
Contributor

bors commented Jul 8, 2016

📌 Commit 5389ccc has been approved by Manishearth

doc: make the conditional-compilation example work

If not, the error `does not have these features: foo` confused.
r? @steveklabnik
…, r=steveklabnik

Add doc examples for `io::Error::from_raw_os_error`.

None
…eveklabnik

Fix `std::path::Path::file_name()` doc

Fixes rust-lang#34632

r? @steveklabnik
…r, r=steveklabnik

Improve DoubleEndedIterator examples

Fixes rust-lang#34065.

r? @steveklabnik
…uct_checks, r=nrc

parser: Remove outdated checks for empty braced struct expressions (`S {}`)

This is a pure refactoring.
r? @nrc
enhancewindows documentation in getting-started

- minor pronoun fix We -> You
- PATH troubleshooting
- dir output is vertical (but did not include timestamps)
- executables not in %PATH% require .\

r? @steveklabnik
Use hints with getaddrinfo() in std::net::lookup_host()

As noted in rust-lang#24250, `std::net::lookup_host()` repeats each IPv[46] address in the result set. The number of repetitions is OS-dependent; e.g., Linux and FreeBSD give three copies, OpenBSD gives two. Filtering the duplicates can be done by the user if `lookup_host()` is used explicitly, but not with functions like `TcpStream::connect()`. What happens with the latter is that any unsuccessful connection attempt will be repeated as many times as there are duplicates of the address.

The program:

```rust
use std::net::TcpStream;

fn main() {
    let _stream = TcpStream::connect("localhost:4444").unwrap();
}
```

results in the following capture:

[capture-before.txt](https://github.com/rust-lang/rust/files/352004/capture-before.txt)

assuming that "localhost" resolves both to ::1 and 127.0.0.1, and that the listening program opens just an IPv4 socket (e.g., `nc -l 127.0.0.1 4444`.) The reason for this behavior is explained in [this comment](rust-lang#24250 (comment)): `getaddrinfo()` is not constrained.

Various OSS projects (I checked out Postfix, OpenLDAP, Apache HTTPD and BIND) which use `getaddrinfo()` generally constrain the result set by using a non-NULL `hints` parameter and setting at least `ai_socktype` to `SOCK_STREAM`. `SOCK_DGRAM` would also work. Other parameters are unnecessary for pure name resolution.

The patch in this PR initializes a `hints` struct and passes it to `getaddrinfo()`, which eliminates the duplicates. The same test program as above with this change produces:

[capture-after.txt](https://github.com/rust-lang/rust/files/352042/capture-after.txt)

All `libstd` tests pass with this patch.
@bors
Copy link
Contributor

bors commented Jul 8, 2016

⌛ Testing commit 5389ccc with merge e7751e4...

bors added a commit that referenced this pull request Jul 8, 2016
Rollup of 9 pull requests

- Successful merges: #34097, #34456, #34610, #34612, #34659, #34688, #34691, #34699, #34700
- Failed merges:
@bors bors merged commit 5389ccc into rust-lang:master Jul 8, 2016
@Centril Centril added the rollup A PR which is a rollup label Oct 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup
Projects
None yet
Development

Successfully merging this pull request may close these issues.