stop restricting packet size in relay mode Quic
This commit is contained in:
parent
87837ca068
commit
5e6ab51e5d
@ -75,6 +75,8 @@ pub async fn manage_connection(
|
||||
}
|
||||
}
|
||||
|
||||
new_conn.update_max_udp_relay_packet_size();
|
||||
|
||||
// connection established, drop the lock implicitly
|
||||
break new_conn;
|
||||
};
|
||||
@ -247,12 +249,15 @@ impl Connection {
|
||||
}
|
||||
|
||||
pub fn update_max_udp_relay_packet_size(&self) {
|
||||
let size = match self.controller.max_datagram_size() {
|
||||
Some(size) => size,
|
||||
None => {
|
||||
log::warn!("[relay] [connection] Failed to detect the max datagram size");
|
||||
65535
|
||||
}
|
||||
let size = match self.udp_relay_mode {
|
||||
UdpRelayMode::Native(()) => match self.controller.max_datagram_size() {
|
||||
Some(size) => size,
|
||||
None => {
|
||||
log::warn!("[relay] [connection] Failed to detect the max datagram size");
|
||||
65535
|
||||
}
|
||||
},
|
||||
UdpRelayMode::Quic(()) => 65535,
|
||||
};
|
||||
|
||||
super::MAX_UDP_RELAY_PACKET_SIZE.store(size, Ordering::Release);
|
||||
|
@ -58,8 +58,6 @@ async fn process_request(
|
||||
} => {
|
||||
conn.udp_sessions().insert(assoc_id, pkt_recv_tx);
|
||||
while let Some((pkt, addr)) = pkt_send_rx.recv().await {
|
||||
conn.update_max_udp_relay_packet_size();
|
||||
|
||||
tokio::spawn(conn.clone().handle_packet_to(
|
||||
assoc_id,
|
||||
pkt,
|
||||
|
@ -74,6 +74,7 @@ impl Connection {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
self.update_max_udp_relay_packet_size();
|
||||
let display_addr = format!("{addr}");
|
||||
|
||||
match send_packet(self, assoc_id, pkt, addr, mode).await {
|
||||
@ -87,6 +88,7 @@ impl Connection {
|
||||
}
|
||||
|
||||
pub async fn handle_packet_from(self, assoc_id: u32, pkt: Bytes, addr: Address) {
|
||||
self.update_max_udp_relay_packet_size();
|
||||
let display_addr = format!("{addr}");
|
||||
|
||||
if let Some(recv_pkt_tx) = self.udp_sessions().get(&assoc_id) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user