Skip to content

Commit

Permalink
Merge pull request #582 from NordicSemiconductor/improvement/access-l…
Browse files Browse the repository at this point in the history
…ayer-logging

[Access Layer] Skip logging if message is decoded multiple times to the same type
  • Loading branch information
philips77 authored Oct 31, 2023
2 parents e6d4136 + 566d92a commit 4f423bd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nRFMeshProvision/Layers/Access Layer/AccessLayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,11 @@ private extension AccessLayer {
if newMessage == nil {
logger?.i(.model, "\(message) received from: \(accessPdu.source.hex), to: \(accessPdu.destination.hex)")
newMessage = message
} else if type(of: message) != type(of: newMessage) {
} else if let newMessage = newMessage, type(of: message) != type(of: newMessage) {
// If another model's delegate decoded the same message to a different
// type, log this with a warning. This other type will be delivered
// to the delegate, but not to the global network delegate.
logger?.w(.model, "\(message) already decoded as \(newMessage!)")
logger?.w(.model, "\(message) already decoded as \(newMessage)")
}
// Deliver the message to the Model if it was signed with an
// Application Key bound to this Model and the message is
Expand Down

0 comments on commit 4f423bd

Please sign in to comment.