1
0

reverting changes on server since 0.8.1

This commit is contained in:
EAimTY 2022-07-31 00:36:04 +09:00
parent 5ca1d2699f
commit 26a7d2489d
2 changed files with 9 additions and 17 deletions

View File

@ -68,14 +68,14 @@ impl Connection {
}; };
let res = tokio::select! { let res = tokio::select! {
res = tokio::spawn(Self::listen_uni_streams(conn.clone(), uni_streams)) => res, res = Self::listen_uni_streams(conn.clone(), uni_streams) => res,
res = tokio::spawn(Self::listen_bi_streams(conn.clone(), bi_streams)) => res, res = Self::listen_bi_streams(conn.clone(), bi_streams) => res,
res = tokio::spawn(Self::listen_datagrams(conn.clone(), datagrams)) => res, res = Self::listen_datagrams(conn.clone(), datagrams) => res,
res = tokio::spawn(Self::listen_received_udp_packet(conn.clone(), recv_pkt_rx)) => res, res = Self::listen_received_udp_packet(conn.clone(), recv_pkt_rx) => res,
Err(err) = Self::handle_authentication_timeout(conn, auth_timeout) => Ok(Err(err)), Err(err) = Self::handle_authentication_timeout(conn, auth_timeout) => Err(err),
}; };
match res.unwrap() { match res {
Ok(()) => unreachable!(), Ok(()) => unreachable!(),
Err(err) => { Err(err) => {
is_closed.set_closed(); is_closed.set_closed();

View File

@ -1,11 +1,11 @@
use bytes::Bytes; use bytes::Bytes;
use crossbeam_utils::atomic::AtomicCell; use crossbeam_utils::atomic::AtomicCell;
use parking_lot::Mutex; use parking_lot::Mutex;
use socket2::{Domain, Protocol, SockAddr, Socket, Type};
use std::{ use std::{
collections::HashMap, collections::HashMap,
io::Result, io::Result,
net::{Ipv6Addr, SocketAddr, UdpSocket as StdUdpSocket}, net::{Ipv4Addr, SocketAddr},
sync::Arc, sync::Arc,
}; };
use tokio::{ use tokio::{
@ -124,15 +124,7 @@ impl UdpSession {
src_addr: SocketAddr, src_addr: SocketAddr,
max_pkt_size: usize, max_pkt_size: usize,
) -> Result<Self> { ) -> Result<Self> {
let socket = Arc::new({ let socket = Arc::new(UdpSocket::bind(SocketAddr::from((Ipv4Addr::UNSPECIFIED, 0))).await?);
let socket = Socket::new(Domain::IPV6, Type::DGRAM, Some(Protocol::UDP))?;
socket.set_only_v6(false)?;
socket.bind(&SockAddr::from(SocketAddr::from((
Ipv6Addr::UNSPECIFIED,
0,
))))?;
UdpSocket::from_std(StdUdpSocket::from(socket))?
});
let (send_pkt_tx, send_pkt_rx) = mpsc::channel(1); let (send_pkt_tx, send_pkt_rx) = mpsc::channel(1);
tokio::spawn(async move { tokio::spawn(async move {