diff --git a/realm_core/Cargo.toml b/realm_core/Cargo.toml index 33de393..46b840d 100644 --- a/realm_core/Cargo.toml +++ b/realm_core/Cargo.toml @@ -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 diff --git a/realm_core/src/tcp/hook.rs b/realm_core/src/tcp/hook.rs index 284ce78..8034652 100644 --- a/realm_core/src/tcp/hook.rs +++ b/realm_core/src/tcp/hook.rs @@ -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")), } }