Skip to content

Commit

Permalink
fixed: agent quic timeout (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
giangndm authored Mar 27, 2024
1 parent 6f5645f commit 08c1bb6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
10 changes: 7 additions & 3 deletions crates/agent/src/connection/quic.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use protocol::key::AgentSigner;
use rustls::pki_types::{CertificateDer, ServerName, UnixTime};
use serde::de::DeserializeOwned;
use std::{error::Error, net::SocketAddr, sync::Arc};
use std::{error::Error, net::SocketAddr, sync::Arc, time::Duration};

use quinn::{ClientConfig, Endpoint, RecvStream, SendStream};
use quinn::{ClientConfig, Endpoint, RecvStream, SendStream, TransportConfig};

use super::{Connection, SubConnection};

Expand Down Expand Up @@ -138,5 +138,9 @@ fn configure_client() -> ClientConfig {
.with_custom_certificate_verifier(SkipServerVerification::new(provider.clone()))
.with_no_client_auth();

ClientConfig::new(Arc::new(crypto))
let mut config = ClientConfig::new(Arc::new(crypto));
let mut transport = TransportConfig::default();
transport.keep_alive_interval(Some(Duration::from_secs(3)));
config.transport_config(Arc::new(transport));
config
}
13 changes: 10 additions & 3 deletions crates/relayer/src/proxy_listener/cluster/quinn_utils.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
use quinn::{AsyncStdRuntime, ClientConfig, Endpoint, EndpointConfig, ServerConfig};
use quinn::{
AsyncStdRuntime, ClientConfig, Endpoint, EndpointConfig, ServerConfig, TransportConfig,
};
use rustls::pki_types::{CertificateDer, PrivatePkcs8KeyDer, ServerName, UnixTime};
use std::error::Error;
use std::sync::Arc;
use std::time::Duration;

use super::vsocket::VirtualUdpSocket;

pub fn make_insecure_quinn_server(socket: VirtualUdpSocket) -> Result<Endpoint, Box<dyn Error>> {
let (server_config, server_cert) = configure_server()?;
let (server_config, _server_cert) = configure_server()?;
let runtime = Arc::new(AsyncStdRuntime);
let mut config = EndpointConfig::default();
config
Expand Down Expand Up @@ -107,5 +110,9 @@ fn configure_client() -> ClientConfig {
.with_custom_certificate_verifier(SkipServerVerification::new(provider.clone()))
.with_no_client_auth();

ClientConfig::new(Arc::new(crypto))
let mut config = ClientConfig::new(Arc::new(crypto));
let mut transport = TransportConfig::default();
transport.keep_alive_interval(Some(Duration::from_secs(3)));
config.transport_config(Arc::new(transport));
config
}

0 comments on commit 08c1bb6

Please sign in to comment.