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 8, 2022
1 parent a861c24 commit c83bb07
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 @@ -299,14 +299,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 c83bb07

Please sign in to comment.