Skip to content

Commit 2a7848c

Browse files
committed
fix: MPTCP on android
1 parent 40d5480 commit 2a7848c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎crates/wind-base/src/direct.rs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,10 @@ async fn connect_direct_tcp_socket2(
157157
SocketAddr::V4(_) => Domain::IPV4,
158158
SocketAddr::V6(_) => Domain::IPV6,
159159
};
160-
let protocol = if mptcp { Some(Protocol::MPTCP) } else { None };
160+
// Protocol::MPTCP is `#[cfg(target_os = "linux")]` in socket2 0.6,
161+
// but this function is compiled for android as well. Use the raw
162+
// libc constant (IPPROTO_MPTCP = 262) which is available on both.
163+
let protocol = if mptcp { Some(Protocol::from(libc::IPPROTO_MPTCP)) } else { None };
161164
let sock = Socket::new(domain, Type::STREAM, protocol)?;
162165

163166
// SO_MARK

0 commit comments

Comments
 (0)