From 9ea92f3f4a93097133164e95d179b258f42abe07 Mon Sep 17 00:00:00 2001 From: Theo Hill Date: Sun, 26 May 2024 19:07:42 -0700 Subject: [PATCH] Reset on all exceptions from cfdp insert_packet()/state_machine() I can't guarantee at this point that these two functions wont throw an unexpected exception and I don't want to do a full audit of their source to compile the list. So instead lets do the quick hack of catching everything. --- oresat_c3/services/edl.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/oresat_c3/services/edl.py b/oresat_c3/services/edl.py index b178e5a..195ca84 100644 --- a/oresat_c3/services/edl.py +++ b/oresat_c3/services/edl.py @@ -481,7 +481,7 @@ def loop(self, pdu: AbstractFileDirectiveBase): if get_packet_destination(pdu) == PacketDestination.DEST_HANDLER: try: self.dest.insert_packet(pdu) - except FsmNotCalledAfterPacketInsertion: + except Exception: # Usually this exception means the library is being used wrong, so we have # to be careful here. However there is a bug in the presence of dropped packets # where dest._params.last_inserted_packet does not get cleared. @@ -490,7 +490,7 @@ def loop(self, pdu: AbstractFileDirectiveBase): else: try: self.source.insert_packet(pdu) - except FsmNotCalledAfterPacketInsertion: + except Exception: logger.exception("source.state_machine() didn't properly clear inserted packet") self.source.reset() @@ -513,7 +513,7 @@ def loop(self, pdu: AbstractFileDirectiveBase): try: self.dest.state_machine() self.source.state_machine() - except (UnretrievedPdusToBeSent, SourceFileDoesNotExist): + except Exception: logger.exception("state_machine failed to update") self.dest.reset() self.source.reset()