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

Split starting a listener out from accepting the first connection. #8954

Closed
wants to merge 2 commits into from

Conversation

anasazi
Copy link
Contributor

@anasazi anasazi commented Sep 3, 2013

The Listener trait takes two type parameters, the type of connection and the type of Acceptor,
and specifies only one method, listen, which consumes the listener and produces an Acceptor.

The Acceptor trait takes one type parameter, the type of connection, and defines two methods.
The accept() method waits for an incoming connection attempt and returns the result.
The incoming() method creates an iterator over incoming connections and is a default method.

Example:

let listener = TcpListener.bind(addr); // Bind to a socket
let acceptor = listener.listen(); // Start the listener
for stream in acceptor.incoming() {
    // Process incoming connections forever (a failure will kill the task).
}

Closes #8689

The Listener trait takes two type parameters, the type of connection and the type of Acceptor,
and specifies only one method, listen, which consumes the listener and produces an Acceptor.

The Acceptor trait takes one type parameter, the type of connection, and defines two methods.
The accept() method waits for an incoming connection attempt and returns the result.
The incoming() method creates an iterator over incoming connections and is a default method.

Example:

let listener = TcpListener.bind(addr); // Bind to a socket
let acceptor = listener.listen(); // Start the listener
for stream in acceptor.incoming() {
    // Process incoming connections forever (or until you break out of the loop)
}
bors added a commit that referenced this pull request Sep 3, 2013
The Listener trait takes two type parameters, the type of connection and the type of Acceptor,
and specifies only one method, listen, which consumes the listener and produces an Acceptor.

The Acceptor trait takes one type parameter, the type of connection, and defines two methods.
The accept() method waits for an incoming connection attempt and returns the result.
The incoming() method creates an iterator over incoming connections and is a default method.

Example:

```rust
let listener = TcpListener.bind(addr); // Bind to a socket
let acceptor = listener.listen(); // Start the listener
for stream in acceptor.incoming() {
    // Process incoming connections forever (a failure will kill the task).
}
```

Closes #8689
@bors bors closed this Sep 3, 2013
DiamondLovesYou pushed a commit to DiamondLovesYou/rust-openssl that referenced this pull request Sep 1, 2014
@Fensteer
Copy link

Fensteer commented Nov 2, 2018

In the current version of TCP implementation, these changes have been overwritten, is it a regression ? The overwrite occurred when net2 has been merge to net.

@eddyb
Copy link
Member

eddyb commented Nov 2, 2018

cc @alexcrichton

@alexcrichton
Copy link
Member

@Fensteer this is, uh, a five-year-old PR. Nearly everything about libstd and rustc has changed since this time. I'd recommend opening a fresh issue.

@anasazi
Copy link
Contributor Author

anasazi commented Nov 3, 2018

Yeah I imagine most of my stuff disappeared with the death of the greenthread runtime.

flip1995 pushed a commit to flip1995/rust that referenced this pull request Jun 16, 2022
Improve lint doc consistency

changelog: none

This is a continuation of rust-lang#8908.

Notable changes:
- Removed empty `Known Problems` sections
- Removed "Good"/"Bad" language (replaced with "Use instead")
- Removed (and added some 😄) duplication
- Ignored the [`create_dir`] example so it doesn't create `clippy_lints/foo` 😄
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants