Skip to content

Commit

Permalink
Fix NodeManagement subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
DerAndereAndi committed Jan 28, 2024
1 parent bb01f02 commit cb60683
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions spine/device_local.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,23 @@ func (r *DeviceLocal) HandleEvent(payload api.EventPayload) {
return
}

if r.RemoteDeviceForSki(payload.Ski) == nil {
remoteDevice := r.RemoteDeviceForSki(payload.Ski)
if remoteDevice == nil {
return
}

// the codefactor warning is invalid, as .(type) check can not be replaced with if then
//revive:disable-next-line
switch payload.Data.(type) {
case *model.NodeManagementDetailedDiscoveryDataType:
_, _ = r.nodeManagement.SubscribeToRemote(payload.Feature.Address())
address := payload.Feature.Address()
if address.Device == nil {
address.Device = remoteDevice.Address()
}
_, _ = r.nodeManagement.SubscribeToRemote(address)

// Request Use Case Data
_, _ = r.nodeManagement.RequestUseCaseData(payload.Device.Ski(), payload.Device.Address(), payload.Device.Sender())
_, _ = r.nodeManagement.RequestUseCaseData(payload.Device.Ski(), remoteDevice.Address(), payload.Device.Sender())
}
}

Expand Down

0 comments on commit cb60683

Please sign in to comment.