Skip to content

Commit fcb0879

Browse files
committed
android: fix build
1 parent b92e08a commit fcb0879

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

leaf/src/mobile/callback.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub mod android {
4444

4545
use anyhow::{anyhow, Result};
4646
use jni::{objects::*, JavaVM};
47-
use parking_lot::RwLock;
47+
use std::sync::RwLock;
4848

4949
static JVM: RwLock<Option<JavaVM>> = RwLock::new(None);
5050
static CALLBACK_PROTECT_SOCKET: RwLock<Option<CallbackProtectSocket>> = RwLock::new(None);
@@ -55,31 +55,31 @@ pub mod android {
5555
}
5656

5757
pub fn set_jvm(vm: JavaVM) {
58-
*JVM.write() = Some(vm);
58+
*JVM.write().unwrap() = Some(vm);
5959
}
6060

6161
pub fn unset_jvm() {
62-
*JVM.write() = None;
62+
*JVM.write().unwrap() = None;
6363
}
6464

6565
pub fn set_protect_socket_callback(class: GlobalRef, name: String) {
66-
*CALLBACK_PROTECT_SOCKET.write() = Some(CallbackProtectSocket { class, name });
66+
*CALLBACK_PROTECT_SOCKET.write().unwrap() = Some(CallbackProtectSocket { class, name });
6767
}
6868

6969
pub fn unset_protect_socket_callback() {
70-
*CALLBACK_PROTECT_SOCKET.write() = None;
70+
*CALLBACK_PROTECT_SOCKET.write().unwrap() = None;
7171
}
7272

7373
pub fn is_protect_socket_callback_set() -> bool {
74-
CALLBACK_PROTECT_SOCKET.read().is_some()
74+
CALLBACK_PROTECT_SOCKET.read().unwrap().is_some()
7575
}
7676

7777
pub fn protect_socket(fd: RawFd) -> Result<()> {
78-
let jvm_g = JVM.read();
78+
let jvm_g = JVM.read().unwrap();
7979
let Some(vm) = jvm_g.as_ref() else {
8080
return Err(anyhow!("Java VM not set"));
8181
};
82-
let cb_g = CALLBACK_PROTECT_SOCKET.read();
82+
let cb_g = CALLBACK_PROTECT_SOCKET.read().unwrap();
8383
let Some(cb) = cb_g.as_ref() else {
8484
return Err(anyhow!("protect socket callback not set"));
8585
};

leaf/src/proxy/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ async fn protect_socket(fd: RawFd) -> io::Result<()> {
130130
format!("failed to protect outbound socket {}: {:?}", fd, e),
131131
)
132132
})?;
133-
log::debug!(
133+
trace!(
134134
"protected socket {} in {} µs",
135135
fd,
136136
start.elapsed().as_micros()

0 commit comments

Comments
 (0)