windows: Make solana-test-validator work (#20099)
* windows: Make solana-test-validator work The important changes to get this going on Windows: * ledger lock needs to be done on a file instead of the directory * IPC service needs to use the Windows pipe naming scheme * always disable the JIT * file logging not possible yet because we can't redirect stderr, but this will change once env_logger fixes the pipe output target! * Integrate review feedback
This commit is contained in:
@@ -15,7 +15,7 @@ use {
|
||||
},
|
||||
std::{
|
||||
net::SocketAddr,
|
||||
path::Path,
|
||||
path::{Path, PathBuf},
|
||||
sync::{Arc, RwLock},
|
||||
thread::{self, Builder},
|
||||
time::{Duration, SystemTime},
|
||||
@@ -171,7 +171,7 @@ impl AdminRpc for AdminRpcImpl {
|
||||
|
||||
// Start the Admin RPC interface
|
||||
pub fn run(ledger_path: &Path, metadata: AdminRpcRequestMetadata) {
|
||||
let admin_rpc_path = ledger_path.join("admin.rpc");
|
||||
let admin_rpc_path = admin_rpc_path(ledger_path);
|
||||
|
||||
let event_loop = tokio::runtime::Builder::new_multi_thread()
|
||||
.thread_name("sol-adminrpc-el")
|
||||
@@ -212,9 +212,29 @@ pub fn run(ledger_path: &Path, metadata: AdminRpcRequestMetadata) {
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
fn admin_rpc_path(ledger_path: &Path) -> PathBuf {
|
||||
#[cfg(target_family = "windows")]
|
||||
{
|
||||
// More information about the wackiness of pipe names over at
|
||||
// https://docs.microsoft.com/en-us/windows/win32/ipc/pipe-names
|
||||
if let Some(ledger_filename) = ledger_path.file_name() {
|
||||
PathBuf::from(format!(
|
||||
"\\\\.\\pipe\\{}-admin.rpc",
|
||||
ledger_filename.to_string_lossy()
|
||||
))
|
||||
} else {
|
||||
PathBuf::from("\\\\.\\pipe\\admin.rpc")
|
||||
}
|
||||
}
|
||||
#[cfg(not(target_family = "windows"))]
|
||||
{
|
||||
ledger_path.join("admin.rpc")
|
||||
}
|
||||
}
|
||||
|
||||
// Connect to the Admin RPC interface
|
||||
pub async fn connect(ledger_path: &Path) -> std::result::Result<gen_client::Client, RpcError> {
|
||||
let admin_rpc_path = ledger_path.join("admin.rpc");
|
||||
let admin_rpc_path = admin_rpc_path(ledger_path);
|
||||
if !admin_rpc_path.exists() {
|
||||
Err(RpcError::Client(format!(
|
||||
"{} does not exist",
|
||||
|
Reference in New Issue
Block a user