mirror of
https://github.com/telemt/telemt.git
synced 2026-11-22 15:26:37 +03:00
feat(client_mss): chunk only the start of the initial server response
With client_mss_bulk the whole authenticated FakeTLS response (ServerHello, CCS, emulated certificate records, tickets - typically ~4 KiB) was written in client_mss-sized chunks: about 50 segments at `tspu`. With ~2% loss at least one segment is lost in ~64% of handshakes, and the burst takes several RTTs to pass the initial congestion window. - New server.client_mss_prefix (Linux, requires client_mss_bulk): `full` (default, current behavior), `server-hello` (through the end of the first TLS record, capped at 2048 bytes, falls back to `full` on unexpected input) or a byte count. Only that prefix is written in MSG_EOR chunks; the rest goes out in one write at the bulk MSS. - Chunk payload accounts for TCP timestamps and never exceeds tcpi_snd_mss. - Removed TcpMaxSegmentGuard: TCP_MAXSEG on an established socket does not change the MSS of outgoing segments on Linux, and its getsockopt/setsockopt failures no longer abort the handshake. TCP_NODELAY is set once. - Docs (en/ru/de), API discovery metadata, strict keys, reload diff.
This commit is contained in:
@@ -418,11 +418,12 @@ async fn write_tls_response<W: AsyncWrite + Unpin>(
|
||||
options: TlsResponseWriteOptions,
|
||||
) -> std::io::Result<()> {
|
||||
#[cfg(target_os = "linux")]
|
||||
if let (Some(fd), Some(fragment_size)) = (options.socket_fd, options.fragment_size) {
|
||||
if let (Some(fd), Some(fragmentation)) = (options.socket_fd, options.fragmentation) {
|
||||
return crate::transport::socket::send_tcp_fragmented_fd(
|
||||
fd,
|
||||
response,
|
||||
usize::from(fragment_size),
|
||||
usize::from(fragmentation.fragment_size),
|
||||
fragmentation.prefix,
|
||||
)
|
||||
.await;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user