mirror of
https://github.com/netbirdio/netbird.git
synced 2025-08-19 11:20:18 +02:00
fix: add connection state to handle reconnects
This commit is contained in:
@@ -89,6 +89,11 @@ func (conn *Connection) Close() error {
|
|||||||
conn.mux.Lock()
|
conn.mux.Lock()
|
||||||
defer conn.mux.Unlock()
|
defer conn.mux.Unlock()
|
||||||
|
|
||||||
|
if !conn.isActive {
|
||||||
|
log.Infof("connection to peer %s has been already closed, skipping", conn.Config.RemoteWgKey.String())
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
log.Debugf("closing connection to peer %s", conn.Config.RemoteWgKey.String())
|
log.Debugf("closing connection to peer %s", conn.Config.RemoteWgKey.String())
|
||||||
|
|
||||||
conn.closeChannel <- true
|
conn.closeChannel <- true
|
||||||
|
Reference in New Issue
Block a user