Currently, rak_rs does not attempt to discover MTU size from the client. Currently, we time out the client if the server doesn't send a OpenConnectReply however this behavior is wrong, we need to continuously send a OpenConnectRequest until the server accepts the MTU size.
Implementation example:
// discover MTU
let mut mtu = MAX_MTU;
let mut connect_request = OpenConnectRequest {
protocol: 11,
mtu_size: mtu
};
for i in (MIN_MTU_SIZE...mtu).rev() {
// attempt to send request
if !send_packet(&socket, connect_request.into()).await {
// error sending
}
let reply = expect_reply!(socket.clone(), OpenConnectReply::id());
if reply.is_none() {
// try again, unless...
if i == MIN_MTU_SIZE {
return Err(HandshakeStatus::Failed);
}
}
// we got a reply!
break;
}
Currently,
rak_rs
does not attempt to discover MTU size from the client. Currently, we time out the client if the server doesn't send aOpenConnectReply
however this behavior is wrong, we need to continuously send aOpenConnectRequest
until the server accepts the MTU size.Implementation example: