[code] improve structure (focus: server)

This commit is contained in:
2025-03-02 13:06:18 +01:00
parent bcf9ad68ad
commit adf6f9d757
11 changed files with 393 additions and 368 deletions

View File

@ -6,12 +6,12 @@ use bytes::BytesMut;
use lanspread_db::db::{Game, GameFileDescription};
use lanspread_proto::{Message as _, Request, Response};
use lanspread_utils::maybe_addr;
use s2n_quic::{client::Connect, provider::limits::Limits, Client as QuicClient, Connection};
use s2n_quic::{Client as QuicClient, Connection, client::Connect, provider::limits::Limits};
use tokio::{
io::AsyncWriteExt,
sync::{
mpsc::{UnboundedReceiver, UnboundedSender},
Mutex,
mpsc::{UnboundedReceiver, UnboundedSender},
},
};
@ -72,9 +72,7 @@ async fn download_game_files(
server_addr: SocketAddr,
tx_notify_ui: UnboundedSender<ClientEvent>,
) -> eyre::Result<()> {
let limits = Limits::default()
.with_max_handshake_duration(Duration::from_secs(3))?
.with_max_idle_timeout(Duration::from_secs(1))?;
let limits = Limits::default().with_max_handshake_duration(Duration::from_secs(3))?;
let client = QuicClient::builder()
.with_tls(CERT_PEM)?
@ -173,7 +171,7 @@ pub async fn run(
loop {
let limits = Limits::default()
.with_max_handshake_duration(Duration::from_secs(3))?
.with_max_idle_timeout(Duration::from_secs(1))?;
.with_max_idle_timeout(Duration::ZERO)?;
let client = QuicClient::builder()
.with_tls(CERT_PEM)?