Fix error when removing peer conn (#264)

When stopping engine, all peer conns have to be closed
and for each peer WireGuard iface is called
to remove WireGuard peer.
This operation happens in a goroutine causing
Engine to remove the whole WireGuard interface before.
Therefore consequent calls to RemovePeer are unsuccessful.
This fix just adds a small delay before removing interface.
This commit is contained in:
Mikhail Bragin
2022-03-13 15:16:16 +01:00
committed by GitHub
parent a3a6283ac6
commit d7b69b91b9
2 changed files with 6 additions and 2 deletions

View File

@ -153,7 +153,7 @@ func (conn *Conn) Open() error {
defer func() {
err := conn.cleanup()
if err != nil {
log.Errorf("error while cleaning up peer connection %s: %v", conn.config.Key, err)
log.Warnf("error while cleaning up peer connection %s: %v", conn.config.Key, err)
return
}
}()