Browse Source

Enable read side jitter for the Tamaraw (server side).

Yawning Angel 3 years ago
parent
commit
391a1eda23
2 changed files with 6 additions and 0 deletions
  1. 3 0
      internal/tcpinfo/tcpinfo_linux.go
  2. 3 0
      padding_tamaraw.go

+ 3 - 0
internal/tcpinfo/tcpinfo_linux.go

@@ -55,6 +55,9 @@ func writeCapacityImpl(f *os.File) (int, error) {
 	socketSpace := sndbufcap - sndbuflen
 
 	// Determine the tcp_space via a TCP_INFO getsockopt() call.
+	//
+	// Linux 4.6.0 and later have tcpi_notsent_bytes, but it will be forever
+	// till I can assume that's present.
 	var info syscall.TCPInfo
 	infoLen := uint32(syscall.SizeofTCPInfo)
 	if _, _, e1 := syscall.Syscall6(syscall.SYS_GETSOCKOPT, fd, syscall.SOL_TCP, syscall.TCP_INFO, uintptr(unsafe.Pointer(&info)), uintptr(unsafe.Pointer(&infoLen)), 0); e1 != 0 {

+ 3 - 0
padding_tamaraw.go

@@ -236,6 +236,9 @@ func newTamarawPadding(conn *commonConn, isClient bool) paddingImpl {
 		p.rho = 5 * 1000               // ms -> usec
 		p.lPpad = p.conn.maxRecordSize // Could lower it by 2 for PPPoE links.
 		p.lSeg = 500
+
+		// Random read side delivery jitter.
+		p.conn.enableReadDelay = true
 	}
 
 	p.Add(1)