Waits for the connection to be closed. Returns a "connection closed" error when the connection is closed. If another error occurs before the connection is closed, that error is returned instead. Use this method when you have an unbounded stream of data to forward to the connection and the protocol does not require the client to periodically acknowledge receipt. If you don't call this method to p
(&self)
| 168 | /// not until the stream of data produces its next message and you attempt |
| 169 | /// to write the data to the connection. |
| 170 | pub async fn wait_closed(&self) -> io::Error |
| 171 | where |
| 172 | A: AsyncReady + Send + Sync, |
| 173 | { |
| 174 | loop { |
| 175 | time::sleep(Duration::from_secs(1)).await; |
| 176 | |
| 177 | match self.ready(Interest::READABLE | Interest::WRITABLE).await { |
| 178 | Ok(ready) if ready.is_read_closed() || ready.is_write_closed() => { |
| 179 | return io::Error::new(io::ErrorKind::Other, "connection closed"); |
| 180 | } |
| 181 | Ok(_) => (), |
| 182 | Err(err) => return err, |
| 183 | } |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | /// Returns the ID associated with this connection. |
| 188 | pub fn conn_id(&self) -> &ConnectionId { |