Skip to content

Commit

Permalink
v 0.1.2 revert to java driver version 1.34.0 to fix compatibility issues
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalillusion committed Jun 24, 2021
1 parent 6087d92 commit 5086c7d
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rudp-tunnel"
version = "0.1.1"
version = "0.1.2"
authors = ["adriano.dalpane <[email protected]>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Usage

**Embedded driver**

The executable embeds the C 64-bit Aeron driver version 1.31.2 for Linux and Windows
The executable embeds the Java version 1.34.0 of the Aeron driver. In order to work correctly, `java` must be available in the path.

**Startup**

Expand Down
Binary file added src/bin/aeron-all-1.34.0.jar
Binary file not shown.
Binary file removed src/bin/aeron_driver.dll
Binary file not shown.
Binary file removed src/bin/aeronmd
Binary file not shown.
Binary file removed src/bin/aeronmd.exe
Binary file not shown.
24 changes: 10 additions & 14 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,19 @@ pub fn run(mode: Mode, args: Arguments) {
info!("Skipping driver launch...");
start_instance(running, mode, &args);
} else {
let driver_path = if cfg!(target_os = "windows") {
extract_driver("aeron_driver.dll", include_bytes!("bin/aeron_driver.dll"));
extract_driver("aeronmd.exe", include_bytes!("bin/aeronmd.exe"))
} else {
extract_driver("aeronmd", include_bytes!("bin/aeronmd"))
};
let driver_path = extract_driver();

let mut command = String::from("java -cp ");
command.push_str(driver_path.as_str());
command.push_str(format!(" -Daeron.dir={} io.aeron.driver.MediaDriver", args.dir_prefix).as_str());

let mut command = String::from(driver_path.as_str());
info!("Launching Aeron driver: {}", command.to_owned());
let mut child = if cfg!(target_os = "windows") {
info!("Launching Aeron Windows driver: {}", command.to_owned());
Command::new("cmd")
.args(&["/C", command.as_str()])
.spawn()
.expect("Error spawning Aeron driver process")
} else {
command.push_str(format!(" -Daeron.dir={}", args.dir_prefix).as_str());
let command = format!("chmod +x {} && {}", driver_path.as_str(), command.as_str());
info!("Launching Aeron Linux driver: {}", command.to_owned());
Command::new("sh")
.arg("-c")
.arg(command.as_str())
Expand Down Expand Up @@ -107,10 +102,11 @@ fn start_instance(running: Arc<AtomicBool>, mode: Mode, args: &Arguments) {
}
}

fn extract_driver(driver_filename: &str, bytes: &[u8]) -> String {
fn extract_driver() -> String {
let bytes = include_bytes!("bin/aeron-all-1.34.0.jar");
let mut driver_path = temp_dir();
driver_path.push(driver_filename);
let mut file = File::create(driver_path.to_owned()).expect("Error extracting Aeron driver");
driver_path.push("aeron-driver.jar");
let mut file = File::create(driver_path.to_owned()).expect("Error extracting Aeron driver jar");
file.write_all(bytes).unwrap();
String::from(driver_path.to_str().unwrap())
}
Expand Down

0 comments on commit 5086c7d

Please sign in to comment.