mirror of
https://github.com/kubenetworks/kubevpn.git
synced 2025-10-16 20:30:42 +08:00
feat: single connection broken will not redo port-forward
This commit is contained in:
@@ -212,8 +212,10 @@ func (c *ConnectOptions) portForward(ctx context.Context, portPair string) error
|
|||||||
podName := podList[0].GetName()
|
podName := podList[0].GetName()
|
||||||
// if port-forward occurs error, check pod is deleted or not, speed up fail
|
// if port-forward occurs error, check pod is deleted or not, speed up fail
|
||||||
runtime.ErrorHandlers = []func(error){func(err error) {
|
runtime.ErrorHandlers = []func(error){func(err error) {
|
||||||
|
if !strings.Contains(err.Error(), "an error occurred forwarding") {
|
||||||
log.Debugf("port-forward occurs error, err: %v, retrying", err)
|
log.Debugf("port-forward occurs error, err: %v, retrying", err)
|
||||||
cancelFunc()
|
cancelFunc()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
// try to detect pod is delete event, if pod is deleted, needs to redo port-forward
|
// try to detect pod is delete event, if pod is deleted, needs to redo port-forward
|
||||||
go checkPodStatus(childCtx, cancelFunc, podName, podInterface)
|
go checkPodStatus(childCtx, cancelFunc, podName, podInterface)
|
||||||
|
Reference in New Issue
Block a user