Skip to content

Commit db152ee

Browse files
committed
try hook connect
1 parent d37bbeb commit db152ee

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

core/src/net/event_loop.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ impl<'e> EventLoop<'e> {
123123
let syscall_mask = <Syscall as Into<&str>>::into(syscall).as_ptr() as usize;
124124
let token = thread_id as usize ^ syscall_mask;
125125
if Syscall::nio() != syscall {
126-
eprintln!("{syscall} {token}");
126+
eprintln!("generate token:{token} for {syscall}");
127127
}
128128
token
129129
}
@@ -255,8 +255,7 @@ impl<'e> EventLoop<'e> {
255255
continue;
256256
}
257257
// resolve completed read/write tasks
258-
let result = cqe.result() as c_longlong;
259-
eprintln!("io_uring finish {token} {result}");
258+
let result = c_longlong::from(cqe.result());
260259
if let Some((_, pair)) = self.syscall_wait_table.remove(&token) {
261260
let (lock, cvar) = &*pair;
262261
let mut pending = lock.lock().expect("lock failed");

core/src/net/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ pub type UserFunc = extern "C" fn(usize) -> usize;
2323

2424
mod selector;
2525

26-
#[allow(clippy::cast_possible_truncation, clippy::cast_sign_loss)]
26+
#[allow(
27+
clippy::cast_possible_truncation,
28+
clippy::cast_sign_loss,
29+
clippy::too_many_arguments
30+
)]
2731
#[cfg(all(target_os = "linux", feature = "io_uring"))]
2832
mod operator;
2933

core/src/net/operator/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#[allow(clippy::too_many_arguments)]
21
#[cfg(all(target_os = "linux", feature = "io_uring"))]
32
mod linux;
43
#[cfg(all(target_os = "linux", feature = "io_uring"))]

hook/src/syscall/windows.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,11 @@ unsafe fn attach() -> std::io::Result<()> {
149149
// addresssize: usize,
150150
// dwmilliseconds: c_uint
151151
// ) -> BOOL);
152-
// impl_hook!("ws2_32.dll", CONNECT, connect(
153-
// fd: SOCKET,
154-
// address: *const SOCKADDR,
155-
// len: c_int
156-
// ) -> c_int);
152+
impl_hook!("ws2_32.dll", CONNECT, connect(
153+
fd: SOCKET,
154+
address: *const SOCKADDR,
155+
len: c_int
156+
) -> c_int);
157157
// Enable the hook
158158
minhook::MinHook::enable_all_hooks()
159159
.map_err(|_| Error::new(ErrorKind::Other, "init all hooks failed !"))

0 commit comments

Comments
 (0)