Closed nickembrey closed 2 years ago
EDIT: this was an incorrect diagnosis of the issue and the below is intentional, expected behavior.
The issue appears to stem from a mutual dependency between Interface.is_up
and Interface.last_activity
:
An interface is only marked as is_up
if its age
is less than a constant: _STALE_INTERFACE
(1 minute):
@property
def is_up(self: Interface) -> bool:
...
return if_dev.isup and self.age < _STALE_INTERFACE
...
Its age
is a property dependent on its last_activity
:
@property
def age(self: Interface) -> dt.timedelta:
...
return dt.datetime.now() - self.last_activity
Its last_activity
is only updated if is_up
is true for the interface:
def handler(self: MagicCANBus, iface: Interface) -> None:
...
while (iface.is_up and iface.running and
self.keep_alive_list[iface.name].is_set()):
frame = iface.recv()
magic_can_bus.py lines 109-138
So, if an interface goes stale, it will never be able to come back up.
When an interface goes offline and comes back online again, CANopen-monitor sometimes does not detect the return of that interface and does not display it or its messages.
This issue can be simulated by: