Skip to content

Commit 8c16bee

Browse files
authored
log error if lldp discovery fails (#175)
1 parent 9f5eb56 commit 8c16bee

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

cmd/internal/core/phone-home.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,13 @@ func (c *Core) ConstantlyPhoneHome(ctx context.Context, interval time.Duration)
4646

4747
ifaceName := iface.Name
4848
// constantly observe LLDP traffic on current machine and current interface
49-
discoveryResultChanWG.Add(1)
50-
go func() {
49+
discoveryResultChanWG.Go(func() {
5150
defer discoveryResultChanWG.Done()
5251
err = lldpcli.Start(c.log, discoveryResultChan)
5352
if err != nil {
54-
c.log.Error("unable to start lldp discovery for interface", "interface", ifaceName)
53+
c.log.Error("unable to start lldp discovery for interface", "interface", ifaceName, "error", err)
5554
}
56-
}()
55+
})
5756
}
5857

5958
// wait all lldp routines to finish to close result channel
@@ -81,7 +80,7 @@ func (c *Core) ConstantlyPhoneHome(ctx context.Context, interval time.Duration)
8180
select {
8281
case <-ticker.C:
8382
msgs := []phoneHomeMessage{}
84-
phoneHomeMessages.Range(func(key, value interface{}) bool {
83+
phoneHomeMessages.Range(func(key, value any) bool {
8584
msg, ok := value.(phoneHomeMessage)
8685
if !ok {
8786
return true

0 commit comments

Comments
 (0)