-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds the `tonic012` feature flag. The tonic 0.11 one is renamed to tonic_011 internally.
- Loading branch information
Showing
5 changed files
with
53 additions
and
5 deletions.
There are no files selected for viewing
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,37 @@ | ||
#[cfg(all(feature = "unix", unix))] | ||
use tonic_012::transport::server::UdsConnectInfo; | ||
use tonic_012::transport::server::{Connected, TcpConnectInfo}; | ||
|
||
use crate::Connection; | ||
|
||
#[derive(Clone)] | ||
pub enum ListenerConnectInfo { | ||
Tcp(TcpConnectInfo), | ||
#[cfg(all(feature = "unix", unix))] | ||
#[cfg_attr(docsrs_alt, doc(cfg(all(feature = "unix", unix))))] | ||
Unix(UdsConnectInfo), | ||
#[cfg(feature = "inetd")] | ||
#[cfg_attr(docsrs_alt, doc(cfg(feature = "inetd")))] | ||
Stdio, | ||
Other, | ||
} | ||
|
||
impl Connected for Connection { | ||
type ConnectInfo = ListenerConnectInfo; | ||
|
||
fn connect_info(&self) -> Self::ConnectInfo { | ||
if let Some(tcp_stream) = self.try_borrow_tcp() { | ||
return ListenerConnectInfo::Tcp(tcp_stream.connect_info()); | ||
} | ||
#[cfg(all(feature = "unix", unix))] | ||
if let Some(unix_stream) = self.try_borrow_unix() { | ||
return ListenerConnectInfo::Unix(unix_stream.connect_info()); | ||
} | ||
#[cfg(feature = "inetd")] | ||
if self.try_borrow_stdio().is_some() { | ||
return ListenerConnectInfo::Stdio; | ||
} | ||
|
||
ListenerConnectInfo::Other | ||
} | ||
} |