Skip to content

Commit 5fb0352

Browse files
committed
Remove PauseTx and PauseRx of the reverse proxy from the e2e test
Part of the patches to fix #17737 During the development of #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. Signed-off-by: Chun-Hung Tseng <henrybear327@gmail.com>
1 parent fd967e0 commit 5fb0352

File tree

1 file changed

+0
-95
lines changed

1 file changed

+0
-95
lines changed

pkg/proxy/server.go

Lines changed: 0 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,6 @@ type server struct {
146146
modifyRxMu sync.RWMutex
147147
modifyRx func(data []byte) []byte
148148

149-
pauseTxMu sync.Mutex
150-
pauseTxc chan struct{}
151-
152-
pauseRxMu sync.Mutex
153-
pauseRxc chan struct{}
154-
155149
latencyTxMu sync.RWMutex
156150
latencyTx time.Duration
157151

@@ -177,9 +171,6 @@ func NewServer(cfg ServerConfig) Server {
177171
readyc: make(chan struct{}),
178172
donec: make(chan struct{}),
179173
errc: make(chan error, 16),
180-
181-
pauseTxc: make(chan struct{}),
182-
pauseRxc: make(chan struct{}),
183174
}
184175

185176
_, fromPort, err := net.SplitHostPort(cfg.From.Host)
@@ -202,9 +193,6 @@ func NewServer(cfg ServerConfig) Server {
202193
s.retryInterval = defaultRetryInterval
203194
}
204195

205-
close(s.pauseTxc)
206-
close(s.pauseRxc)
207-
208196
if strings.HasPrefix(s.from.Scheme, "http") {
209197
s.from.Scheme = "tcp"
210198
}
@@ -443,27 +431,6 @@ func (s *server) ioCopy(dst io.Writer, src io.Reader, ptype proxyType) {
443431
panic("unknown proxy type")
444432
}
445433

446-
// pause before packet dropping, blocking, and forwarding
447-
var pausec chan struct{}
448-
switch ptype {
449-
case proxyTx:
450-
s.pauseTxMu.Lock()
451-
pausec = s.pauseTxc
452-
s.pauseTxMu.Unlock()
453-
case proxyRx:
454-
s.pauseRxMu.Lock()
455-
pausec = s.pauseRxc
456-
s.pauseRxMu.Unlock()
457-
default:
458-
panic("unknown proxy type")
459-
}
460-
select {
461-
case <-pausec:
462-
case <-s.donec:
463-
return
464-
}
465-
466-
// pause first, and then drop packets
467434
if nr2 == 0 {
468435
continue
469436
}
@@ -774,68 +741,6 @@ func (s *server) UnblackholeRx() {
774741
)
775742
}
776743

777-
func (s *server) PauseTx() {
778-
s.pauseTxMu.Lock()
779-
s.pauseTxc = make(chan struct{})
780-
s.pauseTxMu.Unlock()
781-
782-
s.lg.Info(
783-
"paused tx",
784-
zap.String("from", s.From()),
785-
zap.String("to", s.To()),
786-
)
787-
}
788-
789-
func (s *server) UnpauseTx() {
790-
s.pauseTxMu.Lock()
791-
select {
792-
case <-s.pauseTxc: // already unpaused
793-
case <-s.donec:
794-
s.pauseTxMu.Unlock()
795-
return
796-
default:
797-
close(s.pauseTxc)
798-
}
799-
s.pauseTxMu.Unlock()
800-
801-
s.lg.Info(
802-
"unpaused tx",
803-
zap.String("from", s.From()),
804-
zap.String("to", s.To()),
805-
)
806-
}
807-
808-
func (s *server) PauseRx() {
809-
s.pauseRxMu.Lock()
810-
s.pauseRxc = make(chan struct{})
811-
s.pauseRxMu.Unlock()
812-
813-
s.lg.Info(
814-
"paused rx",
815-
zap.String("from", s.To()),
816-
zap.String("to", s.From()),
817-
)
818-
}
819-
820-
func (s *server) UnpauseRx() {
821-
s.pauseRxMu.Lock()
822-
select {
823-
case <-s.pauseRxc: // already unpaused
824-
case <-s.donec:
825-
s.pauseRxMu.Unlock()
826-
return
827-
default:
828-
close(s.pauseRxc)
829-
}
830-
s.pauseRxMu.Unlock()
831-
832-
s.lg.Info(
833-
"unpaused rx",
834-
zap.String("from", s.To()),
835-
zap.String("to", s.From()),
836-
)
837-
}
838-
839744
func (s *server) ResetListener() error {
840745
s.listenerMu.Lock()
841746
defer s.listenerMu.Unlock()

0 commit comments

Comments
 (0)