diff --git a/konnectivity-client/pkg/client/client.go b/konnectivity-client/pkg/client/client.go index bdaa75a81..c55070ae6 100644 --- a/konnectivity-client/pkg/client/client.go +++ b/konnectivity-client/pkg/client/client.go @@ -300,14 +300,15 @@ func (t *grpcTunnel) serve(tunnelCtx context.Context) { resp := pkt.GetCloseResponse() conn, ok := t.conns.get(resp.ConnectID) - if ok { - close(conn.readCh) - conn.closeCh <- resp.Error - close(conn.closeCh) - t.conns.remove(resp.ConnectID) - return + if !ok { + klog.V(1).InfoS("Connection not recognized", "connectionID", resp.ConnectID) + continue } - klog.V(1).InfoS("connection not recognized", "connectionID", resp.ConnectID) + close(conn.readCh) + conn.closeCh <- resp.Error + close(conn.closeCh) + t.conns.remove(resp.ConnectID) + return } } }