mirror of
https://github.com/netbirdio/netbird.git
synced 2026-07-23 17:01:29 +02:00
Fix defer
This commit is contained in:
@@ -1080,7 +1080,9 @@ func (d *Status) GetRelayStates() []relay.ProbeResult {
|
||||
|
||||
// debug lines
|
||||
started := time.Now()
|
||||
defer debugElapsed("GetRelayStates", started)
|
||||
defer func() {
|
||||
debugElapsed("GetRelayStates", started)
|
||||
}()
|
||||
|
||||
if d.relayMgr == nil {
|
||||
defer d.muxRelays.RUnlock()
|
||||
@@ -1125,7 +1127,9 @@ func (d *Status) ForwardingRules() []firewall.ForwardRule {
|
||||
|
||||
// debug lines
|
||||
started := time.Now()
|
||||
defer debugElapsed("ForwardingRules", started)
|
||||
defer func() {
|
||||
debugElapsed("ForwardingRules", started)
|
||||
}()
|
||||
|
||||
defer d.mux.RUnlock()
|
||||
if d.ingressGwMgr == nil {
|
||||
@@ -1291,7 +1295,9 @@ func (d *Status) PublishEvent(
|
||||
|
||||
// debug lines
|
||||
started := time.Now()
|
||||
defer debugElapsed("PublishEvent", started)
|
||||
defer func() {
|
||||
debugElapsed("PublishEvent", started)
|
||||
}()
|
||||
|
||||
defer d.eventMux.Unlock()
|
||||
|
||||
@@ -1360,7 +1366,9 @@ func (d *Status) PeersStatus() (*configurer.Stats, error) {
|
||||
|
||||
// debug lines
|
||||
started := time.Now()
|
||||
defer debugElapsed("PeersStatus", started)
|
||||
defer func() {
|
||||
debugElapsed("PeersStatus", started)
|
||||
}()
|
||||
|
||||
defer d.mux.RUnlock()
|
||||
if d.wgIface == nil {
|
||||
@@ -1379,7 +1387,9 @@ func (d *Status) RefreshWireGuardStats() error {
|
||||
|
||||
// debug lines
|
||||
started := time.Now()
|
||||
defer debugElapsed("RefreshWireGuardStats", started)
|
||||
defer func() {
|
||||
debugElapsed("RefreshWireGuardStats", started)
|
||||
}()
|
||||
|
||||
defer d.mux.Unlock()
|
||||
|
||||
|
||||
@@ -244,7 +244,9 @@ func NewClientWithServerIP(serverURL string, serverIP netip.Addr, authTokenStore
|
||||
// Connect establishes a connection to the relay server. It blocks until the connection is established or an error occurs.
|
||||
func (c *Client) Connect(ctx context.Context) error {
|
||||
start := time.Now()
|
||||
defer c.log.Infof("connect elapsed time: %v", time.Since(start))
|
||||
defer func() {
|
||||
c.log.Infof("connect elapsed time: %v", time.Since(start))
|
||||
}()
|
||||
|
||||
c.readLoopMutex.Lock()
|
||||
defer c.readLoopMutex.Unlock()
|
||||
@@ -290,7 +292,9 @@ func (c *Client) OpenConn(ctx context.Context, dstPeerID string) (net.Conn, erro
|
||||
peerID := messages.HashID(dstPeerID)
|
||||
|
||||
start := time.Now()
|
||||
defer c.log.Infof("connect elapsed time: %v", time.Since(start))
|
||||
defer func() {
|
||||
c.log.Infof("connect elapsed time: %v", time.Since(start))
|
||||
}()
|
||||
|
||||
c.mu.Lock()
|
||||
if !c.serviceIsRunning {
|
||||
|
||||
Reference in New Issue
Block a user