Skip to content

Commit

Permalink
konn-client: Simplify CLOSE_RSP case
Browse files Browse the repository at this point in the history
Again, let's move the code out of the identation and just filter error
cases out first.

There is no behavior change, this change is cosmetical.

Signed-off-by: Rodrigo Campos <[email protected]>
  • Loading branch information
rata authored and ipochi committed Sep 9, 2022
1 parent 37c6957 commit 9f2918c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions konnectivity-client/pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
Expand Down

0 comments on commit 9f2918c

Please sign in to comment.