mirror of
https://github.com/netbirdio/netbird.git
synced 2025-03-03 09:21:12 +01:00
Fix wg state check exit logic
This commit is contained in:
parent
efa0bbdf3d
commit
b62ad97e59
@ -63,10 +63,8 @@ func (w *WorkerRelay) OnNewOffer(remoteOfferAnswer *OfferAnswer) {
|
||||
|
||||
srv := w.preferredRelayServer(currentRelayAddress, remoteOfferAnswer.RelaySrvAddress)
|
||||
|
||||
w.ctx, w.ctxCancel = context.WithCancel(w.parentCtx)
|
||||
relayedConn, err := w.relayManager.OpenConn(srv, w.config.Key, w.disconnected)
|
||||
if err != nil {
|
||||
w.ctxCancel()
|
||||
// todo handle all type errors
|
||||
if errors.Is(err, relayClient.ErrConnAlreadyExists) {
|
||||
w.log.Infof("do not need to reopen relay connection")
|
||||
@ -76,6 +74,8 @@ func (w *WorkerRelay) OnNewOffer(remoteOfferAnswer *OfferAnswer) {
|
||||
return
|
||||
}
|
||||
|
||||
w.ctx, w.ctxCancel = context.WithCancel(w.parentCtx)
|
||||
|
||||
go w.wgStateCheck(relayedConn)
|
||||
|
||||
w.log.Debugf("Relay connection established with %s", srv)
|
||||
|
Loading…
Reference in New Issue
Block a user