realm_core: switch to hook v0.1.4

This commit is contained in:
zephyr
2022-05-04 17:46:35 +09:00
parent 579b54b0af
commit b5406ec550
2 changed files with 5 additions and 4 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
[package]
name = "realm_core"
version = "0.2.3"
version = "0.2.4"
authors = ["Realm Contributors"]
description = "Realm's core facilities."
repository = "https://github.com/zhboner/realm/realm_core"
@@ -14,7 +14,7 @@ license = "MIT"
# realm
realm_io = "0.2.7"
realm_syscall = "0.1.4"
realm_hook = { version = "0.1.3", optional = true }
realm_hook = { version = "0.1.4", optional = true }
kaminari = { version = "0.7.2", optional = true }
# other
+3 -2
View File
@@ -22,11 +22,12 @@ pub async fn pre_connect_hook<'a>(
while local.peek(&mut buf).await? < len {}
}
let idx = decide_remote_idx(buf.as_ptr());
let mut idx = extra_raddrs.len() as i32;
idx = decide_remote_idx(idx, buf.as_ptr());
match idx {
0 => Ok(raddr),
i if i >= 1 && i <= extra_raddrs.len() as i32 => Ok(&extra_raddrs[i as usize - 1]),
i if i >= 1 && i <= idx => Ok(&extra_raddrs[i as usize - 1]),
_ => Err(Error::new(ErrorKind::Other, "rejected by pre-connect hook")),
}
}