fix: prevent QUIC heartbeat stalls and isolate TCP retransmission counters [CI] [SKIP TESTS]
This commit is contained in:
1 parent
0066a947da
commit
0fd38b2367
14 files changed
+299
-50
No files matched your search
@@ -22,6 +22,7 @@ public static class Kinds
|
||||
[
|
||||
Col.TsLocal("ts"), Col.U8("side"), Col.U32("srtt_us"), Col.U32("rttvar_us"), Col.U32("cwnd"),
|
||||
Col.U32("retrans_total"), Col.U32("segs_out"), Col.U64("bytes_acked"),
|
||||
new ColumnSpec("conn", ColumnType.U64, ColumnEnc.Plain, true),
|
||||
],
|
||||
Union: true);
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Buffers;
|
||||
using System.Buffers.Binary;
|
||||
using System.Security.Cryptography;
|
||||
using Fleet.Core;
|
||||
@@ -124,9 +125,18 @@ public static class TcpWire
|
||||
|
||||
public static async ValueTask WriteMessageAsync(Stream stream, ReadOnlyMemory<byte> body, CancellationToken ct)
|
||||
{
|
||||
byte[] prefix = new byte[VarInt.MaxBytes];
|
||||
int n = VarInt.Write(prefix, (ulong)body.Length);
|
||||
await stream.WriteAsync(prefix.AsMemory(0, n), ct);
|
||||
await stream.WriteAsync(body, ct);
|
||||
byte[] frame = ArrayPool<byte>.Shared.Rent(checked(VarInt.MaxBytes + body.Length));
|
||||
try
|
||||
{
|
||||
int n = VarInt.Write(frame, (ulong)body.Length);
|
||||
body.CopyTo(frame.AsMemory(n));
|
||||
// TCP_NODELAY is enabled: two writes otherwise create a tiny
|
||||
// length-only segment before every echo body (and two TLS records).
|
||||
await stream.WriteAsync(frame.AsMemory(0, n + body.Length), ct);
|
||||
}
|
||||
finally
|
||||
{
|
||||
ArrayPool<byte>.Shared.Return(frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user