Skip to content

Commit c83bb07

Browse files
rataipochi
authored andcommitted
konn-client: Simplify CLOSE_RSP case
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]>
1 parent a861c24 commit c83bb07

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

konnectivity-client/pkg/client/client.go

+8-7
Original file line numberDiff line numberDiff line change
@@ -299,14 +299,15 @@ func (t *grpcTunnel) serve(tunnelCtx context.Context) {
299299
resp := pkt.GetCloseResponse()
300300
conn, ok := t.conns.get(resp.ConnectID)
301301

302-
if ok {
303-
close(conn.readCh)
304-
conn.closeCh <- resp.Error
305-
close(conn.closeCh)
306-
t.conns.remove(resp.ConnectID)
307-
return
302+
if !ok {
303+
klog.V(1).InfoS("connection not recognized", "connectionID", resp.ConnectID)
304+
continue
308305
}
309-
klog.V(1).InfoS("connection not recognized", "connectionID", resp.ConnectID)
306+
close(conn.readCh)
307+
conn.closeCh <- resp.Error
308+
close(conn.closeCh)
309+
t.conns.remove(resp.ConnectID)
310+
return
310311
}
311312
}
312313
}

0 commit comments

Comments
 (0)