Skip to content

Commit 9f2918c

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 37c6957 commit 9f2918c

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

konnectivity-client/pkg/client/client.go

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

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

0 commit comments

Comments
 (0)