1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-10 06:34:17 +03:00

fixup windows build

This commit is contained in:
Wez Furlong 2019-06-22 13:40:41 -07:00
parent be345853cd
commit 4c6768fd2b
3 changed files with 41 additions and 28 deletions

View File

@ -373,6 +373,7 @@ pub struct DaemonOptions {
}
impl DaemonOptions {
#[cfg_attr(windows, allow(dead_code))]
pub fn pid_file(&self) -> PathBuf {
self.pid_file
.as_ref()
@ -380,6 +381,7 @@ impl DaemonOptions {
.unwrap_or_else(|| RUNTIME_DIR.join("pid"))
}
#[cfg_attr(windows, allow(dead_code))]
pub fn stdout(&self) -> PathBuf {
self.stdout
.as_ref()
@ -387,6 +389,7 @@ impl DaemonOptions {
.unwrap_or_else(|| RUNTIME_DIR.join("log"))
}
#[cfg_attr(windows, allow(dead_code))]
pub fn stderr(&self) -> PathBuf {
self.stderr
.as_ref()

View File

@ -342,7 +342,7 @@ impl Client {
key: tls_client
.pem_private_key
.as_ref()
.ok_or_else(|| failure::err_msg("missing mux_client_pem_private_key config value"))?
.ok_or_else(|| failure::err_msg("missing pem_private_key config value"))?
.into(),
cert: tls_client.pem_cert.clone(),
chain: tls_client.pem_ca.clone(),
@ -350,7 +350,7 @@ impl Client {
let connector = TlsConnector::builder()
.identity(identity.try_into()?)
.danger_accept_invalid_hostnames(tls_client.accept_invalid_hostnames.unwrap_or(false))
.danger_accept_invalid_hostnames(tls_client.accept_invalid_hostnames)
.build()?;
let stream = TcpStream::connect(remote_address)

View File

@ -158,6 +158,8 @@ impl TryFrom<IdentitySource> for Identity {
mod not_ossl {
use super::*;
use native_tls::TlsAcceptor;
use std::convert::TryInto;
struct NetListener {
acceptor: Arc<TlsAcceptor>,
listener: TcpListener,
@ -206,6 +208,39 @@ mod not_ossl {
}
}
}
pub fn spawn_tls_listener(
_config: &Arc<Config>,
executor: Box<dyn Executor>,
tls_server: &TlsDomainServer,
) -> Fallible<()> {
let identity = IdentitySource::PemFiles {
key: tls_server
.pem_private_key
.as_ref()
.ok_or_else(|| err_msg("missing pem_private_key config value"))?
.into(),
cert: tls_server.pem_cert.clone(),
chain: tls_server.pem_ca.clone(),
};
let mut net_listener = NetListener::new(
TcpListener::bind(&tls_server.bind_address).map_err(|e| {
format_err!(
"error binding to bind_address {}: {}",
tls_server.bind_address,
e
)
})?,
TlsAcceptor::new(identity.try_into()?)?,
executor,
);
thread::spawn(move || {
net_listener.run();
});
Ok(())
}
}
#[cfg(any(feature = "openssl", unix))]
@ -912,32 +947,7 @@ fn spawn_tls_listener(
executor: Box<dyn Executor>,
tls_server: &TlsDomainServer,
) -> Fallible<()> {
use std::convert::TryInto;
let identity = IdentitySource::PemFiles {
key: tls_server
.pem_private_key
.as_ref()
.ok_or_else(|| err_msg("missing mux_server_pem_private_key config value"))?
.into(),
cert: tls_server.pem_cert.clone(),
chain: tls_server.pem_ca.clone(),
};
let mut net_listener = NetListener::new(
TcpListener::bind(&tls_server.bind_address).map_err(|e| {
format_err!(
"error binding to mux_server_bind_address {}: {}",
tls_server.bind_address,
e
)
})?,
TlsAcceptor::new(identity.try_into()?)?,
executor,
);
thread::spawn(move || {
net_listener.run();
});
Ok(())
not_ossl::spawn_tls_listener(config, executor, tls_server)
}
pub fn spawn_listener(config: &Arc<Config>, executor: Box<dyn Executor>) -> Fallible<()> {