mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-17 15:56:39 +00:00
Fix constructor of conn.go
This commit is contained in:
@@ -77,7 +77,7 @@ func (m *Manager) RemovePeer(peerID string) bool {
|
||||
|
||||
m.listenerMgr.RemovePeer(peerID)
|
||||
delete(m.managedPeers, peerID)
|
||||
return false
|
||||
return true
|
||||
}
|
||||
|
||||
// Close the manager and all the listeners
|
||||
|
||||
@@ -158,8 +158,6 @@ func NewConn(engineCtx context.Context, config ConnConfig, statusRecorder *Statu
|
||||
|
||||
conn.guard = guard.NewGuard(connLog, ctrl, conn.isConnectedOnAllWay, config.Timeout, srWatcher)
|
||||
|
||||
go conn.handshaker.Listen()
|
||||
|
||||
return conn, nil
|
||||
}
|
||||
|
||||
@@ -169,12 +167,13 @@ func NewConn(engineCtx context.Context, config ConnConfig, statusRecorder *Statu
|
||||
// todo: prevent double open
|
||||
func (conn *Conn) Open() {
|
||||
conn.semaphore.Add(conn.ctx)
|
||||
conn.Log.Infof("open connection to peer")
|
||||
|
||||
conn.mu.Lock()
|
||||
defer conn.mu.Unlock()
|
||||
conn.opened = true
|
||||
|
||||
go conn.handshaker.Listen()
|
||||
|
||||
peerState := State{
|
||||
PubKey: conn.config.Key,
|
||||
IP: conn.config.WgConfig.AllowedIps[0].Addr().String(),
|
||||
|
||||
Reference in New Issue
Block a user