Skip to content

Commit

Permalink
Added minor comment
Browse files Browse the repository at this point in the history
  • Loading branch information
lemunozm committed May 17, 2021
1 parent c6bd25e commit f8be160
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ For example, in order to include only *TCP* and *UDP*, add to your `Cargo.toml`:
message-io = { version = "0.14", default-features = false, features = ["tcp", "udp"] }
```

***Read before update to 0.14**: Version **0.14** modifies the [`connect()`](https://docs.rs/message-io/latest/message_io/network/struct.NetworkController.html#method.connect) behaviour to perform a
_**Read before update to 0.14**: Version **0.14** modifies the [`connect()`](https://docs.rs/message-io/latest/message_io/network/struct.NetworkController.html#method.connect) behaviour to perform a
[**non**-blocking connections](https://github.com/lemunozm/message-io/issues/61) instead.
It is recommended to use this non-blocking mode in order to get the
best scalability and performance in your application. If you need to perform
a similar blocking connection as before (version 0.13), you can call to [`connect_sync()`](https://docs.rs/message-io/latest/message_io/network/struct.NetworkController.html#method.connect_sync).
Note also that the previous `NetEvent::Connect` has been renamed to `NetEvent::Accepted`.
The current `NetEvent::Connect` is a new event to deal with the new non-blocking connections.
See [`NetEvent`](https://docs.rs/message-io/latest/message_io/network/enum.NetEvent.html) docs for more info.*
See [`NetEvent`](https://docs.rs/message-io/latest/message_io/network/enum.NetEvent.html) docs for more info._

### All in one: TCP, UDP and WebSocket echo server
The following example is the simplest server that reads messages from the clients and responds
Expand Down
3 changes: 3 additions & 0 deletions src/adapters/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ impl Remote for RemoteResource {
}
}

/// Check if a TcpStream can be considered connected.
pub fn check_stream_ready(stream: &TcpStream) -> PendingStatus {
// A multiplatform non-blocking way to determine if the TCP stream is connected:
// Extracted from: https://github.com/tokio-rs/mio/issues/1486
if let Ok(Some(_)) = stream.take_error() {
return PendingStatus::Disconnected
}
Expand Down

0 comments on commit f8be160

Please sign in to comment.