Repository navigation
Commit 4fe3881
Gracefully handle errors when binding SocketCAN fails.
The parent class BusABC expects to be shutdown properly, checked via
its self._is_shutdown flag during object deletion. But that flag is
only set when the base class shutdown() is called, which doesn't
happen if instantiation of the concrete class failed in can.Bus(). So
there is no way to avoid the warning message "SocketcanBus was not
properly shut down" if the constructor raised an exception.
This change addresses that issue for the SocketCAN interface, by
catching an OSError exception in bind_socket(), logging it, and
calling self.shutdown().1 parent 046af70 commit 4fe3881
1 file changed
Lines changed: 14 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
706 | 706 | | |
707 | 707 | | |
708 | 708 | | |
709 | | - | |
710 | | - | |
711 | | - | |
712 | | - | |
713 | | - | |
714 | | - | |
715 | | - | |
716 | | - | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
717 | 723 | | |
718 | 724 | | |
719 | 725 | | |
| |||
0 commit comments