parent
70a16e91a5
commit
3635a68129
|
@ -13,19 +13,19 @@ fn main() {
|
||||||
};
|
};
|
||||||
let perf_libs_dir = perf_libs_dir.to_str().unwrap();
|
let perf_libs_dir = perf_libs_dir.to_str().unwrap();
|
||||||
|
|
||||||
// Ensure `perf_libs_dir` exists. It's been observed that
|
|
||||||
// a cargo:rerun-if-changed= directive with a non-existent
|
|
||||||
// directory triggers a rebuild on every |cargo build| invocation
|
|
||||||
fs::create_dir_all(&perf_libs_dir).unwrap_or_else(|err| {
|
|
||||||
if err.kind() != std::io::ErrorKind::AlreadyExists {
|
|
||||||
panic!("Unable to create {}: {:?}", perf_libs_dir, err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
let chacha = !env::var("CARGO_FEATURE_CHACHA").is_err();
|
let chacha = !env::var("CARGO_FEATURE_CHACHA").is_err();
|
||||||
let cuda = !env::var("CARGO_FEATURE_CUDA").is_err();
|
let cuda = !env::var("CARGO_FEATURE_CUDA").is_err();
|
||||||
|
|
||||||
if chacha || cuda {
|
if chacha || cuda {
|
||||||
|
// Ensure `perf_libs_dir` exists. It's been observed that
|
||||||
|
// a cargo:rerun-if-changed= directive with a non-existent
|
||||||
|
// directory triggers a rebuild on every |cargo build| invocation
|
||||||
|
fs::create_dir_all(&perf_libs_dir).unwrap_or_else(|err| {
|
||||||
|
if err.kind() != std::io::ErrorKind::AlreadyExists {
|
||||||
|
panic!("Unable to create {}: {:?}", perf_libs_dir, err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
println!("cargo:rerun-if-changed={}", perf_libs_dir);
|
println!("cargo:rerun-if-changed={}", perf_libs_dir);
|
||||||
println!("cargo:rustc-link-search=native={}", perf_libs_dir);
|
println!("cargo:rustc-link-search=native={}", perf_libs_dir);
|
||||||
}
|
}
|
||||||
|
|
|
@ -513,6 +513,15 @@ pub fn deploy(
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
fn symlink_dir<P: AsRef<Path>, Q: AsRef<Path>>(src: P, dst: Q) -> std::io::Result<()> {
|
||||||
|
std::os::windows::fs::symlink_dir(src, dst)
|
||||||
|
}
|
||||||
|
#[cfg(not(windows))]
|
||||||
|
fn symlink_dir<P: AsRef<Path>, Q: AsRef<Path>>(src: P, dst: Q) -> std::io::Result<()> {
|
||||||
|
std::os::unix::fs::symlink(src, dst)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn update(config_file: &str) -> Result<bool, String> {
|
pub fn update(config_file: &str) -> Result<bool, String> {
|
||||||
let update_manifest = info(config_file, false)?;
|
let update_manifest = info(config_file, false)?;
|
||||||
if update_manifest.is_none() {
|
if update_manifest.is_none() {
|
||||||
|
@ -565,7 +574,7 @@ pub fn update(config_file: &str) -> Result<bool, String> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let _ = fs::remove_dir_all(config.active_release_dir());
|
let _ = fs::remove_dir_all(config.active_release_dir());
|
||||||
std::os::unix::fs::symlink(
|
symlink_dir(
|
||||||
release_dir.join("solana-release"),
|
release_dir.join("solana-release"),
|
||||||
config.active_release_dir(),
|
config.active_release_dir(),
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
//! The `netutil` module assists with networking
|
//! The `netutil` module assists with networking
|
||||||
use nix::sys::socket::setsockopt;
|
|
||||||
use nix::sys::socket::sockopt::{ReuseAddr, ReusePort};
|
|
||||||
use rand::{thread_rng, Rng};
|
use rand::{thread_rng, Rng};
|
||||||
use socket2::{Domain, SockAddr, Socket, Type};
|
use socket2::{Domain, SockAddr, Socket, Type};
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
use std::net::{IpAddr, Ipv4Addr, SocketAddr, TcpListener, TcpStream, ToSocketAddrs, UdpSocket};
|
use std::net::{IpAddr, Ipv4Addr, SocketAddr, TcpListener, TcpStream, ToSocketAddrs, UdpSocket};
|
||||||
use std::os::unix::io::AsRawFd;
|
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
mod ip_echo_server;
|
mod ip_echo_server;
|
||||||
|
@ -106,7 +103,18 @@ pub fn parse_host_port(host_port: &str) -> Result<SocketAddr, String> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
fn udp_socket(_reuseaddr: bool) -> io::Result<Socket> {
|
||||||
|
let sock = Socket::new(Domain::ipv4(), Type::dgram(), None)?;
|
||||||
|
Ok(sock)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(windows))]
|
||||||
fn udp_socket(reuseaddr: bool) -> io::Result<Socket> {
|
fn udp_socket(reuseaddr: bool) -> io::Result<Socket> {
|
||||||
|
use nix::sys::socket::setsockopt;
|
||||||
|
use nix::sys::socket::sockopt::{ReuseAddr, ReusePort};
|
||||||
|
use std::os::unix::io::AsRawFd;
|
||||||
|
|
||||||
let sock = Socket::new(Domain::ipv4(), Type::dgram(), None)?;
|
let sock = Socket::new(Domain::ipv4(), Type::dgram(), None)?;
|
||||||
let sock_fd = sock.as_raw_fd();
|
let sock_fd = sock.as_raw_fd();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue