From fd967e08d08e7daf1d251ae4380bbeb2c23eaccf Mon Sep 17 00:00:00 2001 From: Chun-Hung Tseng Date: Wed, 25 Sep 2024 23:09:43 +0200 Subject: [PATCH] Remove LatencyAccept of the reverse proxy from the e2e test Part of the patches to fix https://github.com/etcd-io/etcd/issues/17737 During the development of https://github.com/etcd-io/etcd/pull/17938, we agreed that during the transition to L7 forward proxy, unused features and features targeting L4 reverse proxy will be dropped. This feature falls under the unused feature. Also, the initial implementation has a bug: if connections are not created continuously, the latency accept will not work. Consider the following case: a) set latency accept b) put latency accept into effect c) latency accept will start idling the goroutine d) block-wait at accept() - waiting for new connections e) new connection comes in - establish it f) go to c -> as we can see, if the request come every x seconds, where x is larger than the latency accept time we set, we can see that the latency accept has no effect. Signed-off-by: Chun-Hung Tseng --- pkg/proxy/server.go | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/pkg/proxy/server.go b/pkg/proxy/server.go index 4e15df3d54f..de41276394d 100644 --- a/pkg/proxy/server.go +++ b/pkg/proxy/server.go @@ -59,8 +59,6 @@ type Server interface { // Close closes listener and transport. Close() error - LatencyAccept() time.Duration - // DelayTx adds latency ± random variable for "outgoing" traffic // in "sending" layer. DelayTx(latency, rv time.Duration) @@ -142,9 +140,6 @@ type server struct { listenerMu sync.RWMutex listener net.Listener - latencyAcceptMu sync.RWMutex - latencyAccept time.Duration - modifyTxMu sync.RWMutex modifyTx func(data []byte) []byte @@ -263,17 +258,6 @@ func (s *server) listenAndServe() { close(s.readyc) for { - s.latencyAcceptMu.RLock() - lat := s.latencyAccept - s.latencyAcceptMu.RUnlock() - if lat > 0 { - select { - case <-time.After(lat): - case <-s.donec: - return - } - } - s.listenerMu.RLock() ln := s.listener s.listenerMu.RUnlock() @@ -609,13 +593,6 @@ func (s *server) Close() (err error) { return err } -func (s *server) LatencyAccept() time.Duration { - s.latencyAcceptMu.RLock() - d := s.latencyAccept - s.latencyAcceptMu.RUnlock() - return d -} - func (s *server) DelayTx(latency, rv time.Duration) { if latency <= 0 { return