Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…o main
  • Loading branch information
qunwei committed Dec 20, 2022
2 parents 2825262 + a863be4 commit 1e38ddf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dubbo/src/framework.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl Dubbo {
}

pub fn init(&mut self) {
let conf = self.config.get_or_insert_with(|| get_global_config());
let conf = self.config.get_or_insert_with(get_global_config);
tracing::debug!("global conf: {:?}", conf);

for (name, url) in conf.registries.iter() {
Expand Down
2 changes: 2 additions & 0 deletions dubbo/src/triple/transport/connector/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

pub mod http_connector;
#[cfg(target_os = "unix")]
pub mod unix_connector;

use hyper::Uri;
Expand Down Expand Up @@ -78,6 +79,7 @@ pub fn get_connector(connector: String) -> BoxCloneService<Uri, BoxIO, crate::Er
let c = http_connector::HttpConnector::new();
BoxCloneService::new(Connector::new(c))
}
#[cfg(target_os = "unix")]
"unix" => {
let c = unix_connector::UnixConnector::new();
BoxCloneService::new(Connector::new(c))
Expand Down
5 changes: 3 additions & 2 deletions dubbo/src/triple/transport/listener/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

pub mod tcp_listener;
#[cfg(target_os = "unix")]
pub mod unix_listener;

use std::net::SocketAddr;
Expand All @@ -25,7 +26,6 @@ use tokio::io::{AsyncRead, AsyncWrite};

use super::io::BoxIO;
pub use tcp_listener::TcpListener;
pub use unix_listener::UnixListener;

#[async_trait]
pub trait Listener: Send + Sync {
Expand Down Expand Up @@ -64,7 +64,8 @@ impl<T: Listener> Listener for WrappedListener<T> {
pub async fn get_listener(name: String, addr: SocketAddr) -> Result<BoxListener, crate::Error> {
match name.as_str() {
"tcp" => Ok(TcpListener::bind(addr).await?.boxed()),
"unix" => Ok(UnixListener::bind(addr).await?.boxed()),
#[cfg(target_os = "unix")]
"unix" => Ok(unix_listener::UnixListener::bind(addr).await?.boxed()),
_ => {
tracing::warn!("no support listener: {:?}", name);
Err(Box::new(crate::status::DubboError::new(format!(
Expand Down

0 comments on commit 1e38ddf

Please sign in to comment.