1
0

using IPv6 on server outbound UDP sockets

This commit is contained in:
EAimTY 2022-07-31 00:47:42 +09:00
parent 16fc2d45f0
commit 75d51be659

View File

@ -5,7 +5,7 @@ use parking_lot::Mutex;
use std::{
collections::HashMap,
io::Result,
net::{Ipv4Addr, SocketAddr},
net::{Ipv6Addr, SocketAddr},
sync::Arc,
};
use tokio::{
@ -124,7 +124,7 @@ impl UdpSession {
src_addr: SocketAddr,
max_pkt_size: usize,
) -> Result<Self> {
let socket = Arc::new(UdpSocket::bind(SocketAddr::from((Ipv4Addr::UNSPECIFIED, 0))).await?);
let socket = Arc::new(UdpSocket::bind(SocketAddr::from((Ipv6Addr::UNSPECIFIED, 0))).await?);
let (send_pkt_tx, send_pkt_rx) = mpsc::channel(1);
tokio::spawn(async move {