refactor: Use plain channel send or receive

fix issue #4369

should use a simple channel send/receive instead of select with a single
case

Signed-off-by: Deshi Xiao <xiaods@gmail.com>
This commit is contained in:
Deshi Xiao 2021-11-01 14:20:16 +08:00 committed by Brad Davidson
parent f9f1cabe9c
commit f1622129e4

View File

@ -92,8 +92,7 @@ func Setup(ctx context.Context, config *config.Node, proxy proxy.Proxy) error {
} }
watching: watching:
for { for {
select { ev, ok := <-watch.ResultChan()
case ev, ok := <-watch.ResultChan():
if !ok || ev.Type == watchtypes.Error { if !ok || ev.Type == watchtypes.Error {
if ok { if ok {
logrus.Errorf("Tunnel endpoint watch channel closed: %v", ev) logrus.Errorf("Tunnel endpoint watch channel closed: %v", ev)
@ -131,7 +130,6 @@ func Setup(ctx context.Context, config *config.Node, proxy proxy.Proxy) error {
} }
} }
} }
}
}() }()
wait := make(chan int, 1) wait := make(chan int, 1)