-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: don't reuse connection when it closed
- Loading branch information
Showing
15 changed files
with
147 additions
and
83 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
use futures::Future; | ||
use tokio::io::{self, Interest, Ready}; | ||
|
||
use super::conn::{OwnedReadHalf, OwnedWriteHalf}; | ||
|
||
/// Asynchronous IO readiness. | ||
/// | ||
/// Like [`tokio::io::AsyncRead`] or [`tokio::io::AsyncWrite`], but for | ||
/// readiness events. | ||
pub trait AsyncReady { | ||
/// Checks for IO readiness. | ||
/// | ||
/// See [`tokio::net::TcpStream::ready`] for details. | ||
fn ready(&self, interest: Interest) -> impl Future<Output = io::Result<Ready>> + Send; | ||
} | ||
|
||
impl AsyncReady for OwnedReadHalf { | ||
async fn ready(&self, interest: Interest) -> io::Result<Ready> { | ||
match self { | ||
OwnedReadHalf::Tcp(half) => half.ready(interest).await, | ||
#[cfg(target_family = "unix")] | ||
OwnedReadHalf::Unix(half) => half.ready(interest).await, | ||
#[cfg(feature = "rustls")] | ||
OwnedReadHalf::Rustls(_) => todo!(), | ||
#[cfg(feature = "native-tls")] | ||
OwnedReadHalf::NativeTls(_) => todo!(), | ||
} | ||
} | ||
} | ||
|
||
impl AsyncReady for OwnedWriteHalf { | ||
async fn ready(&self, interest: Interest) -> io::Result<Ready> { | ||
match self { | ||
OwnedWriteHalf::Tcp(half) => half.ready(interest).await, | ||
#[cfg(target_family = "unix")] | ||
OwnedWriteHalf::Unix(half) => half.ready(interest).await, | ||
#[cfg(feature = "rustls")] | ||
OwnedWriteHalf::Rustls(_) => todo!(), | ||
#[cfg(feature = "native-tls")] | ||
OwnedWriteHalf::NativeTls(_) => todo!(), | ||
} | ||
} | ||
} |
Oops, something went wrong.