mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +00:00
Reset streams when an error happens during port-forward
Signed-off-by: Maciej Szulik <soltysh@gmail.com>
This commit is contained in:
parent
d9b95ea94f
commit
aa11f2461f
@ -256,6 +256,12 @@ func (h *httpStreamHandler) portForward(p *httpStreamPair) {
|
|||||||
msg := fmt.Errorf("error forwarding port %d to pod %s, uid %v: %v", port, h.pod, h.uid, err)
|
msg := fmt.Errorf("error forwarding port %d to pod %s, uid %v: %v", port, h.pod, h.uid, err)
|
||||||
utilruntime.HandleError(msg)
|
utilruntime.HandleError(msg)
|
||||||
fmt.Fprint(p.errorStream, msg.Error())
|
fmt.Fprint(p.errorStream, msg.Error())
|
||||||
|
// receiving an error from a port-forward operation indicates a problem
|
||||||
|
// with data stream most probably, thus we want to reset the streams
|
||||||
|
// indicating there was a problem and allow a new set of streams be
|
||||||
|
// created to mitigate the problem
|
||||||
|
p.dataStream.Reset() // nolint:errcheck
|
||||||
|
p.errorStream.Reset() // nolint:errcheck
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user