Fix exceptions on Channel shutdown

This commit is contained in:
Aaron Heise 2023-02-28 08:38:23 -06:00
parent 72300cc821
commit 9963cf37b8
No known key found for this signature in database
GPG Key ID: 6BA54088C41DE8BF

View File

@ -507,13 +507,15 @@ class LinkChannelOutlet(ChannelOutletBase):
def inner(receipt: RNS.PacketReceipt): def inner(receipt: RNS.PacketReceipt):
callback(packet) callback(packet)
packet.receipt.set_timeout_callback(inner if callback else None) if packet and packet.receipt:
packet.receipt.set_timeout_callback(inner if callback else None)
def set_packet_delivered_callback(self, packet: RNS.Packet, callback: Callable[[RNS.Packet], None] | None): def set_packet_delivered_callback(self, packet: RNS.Packet, callback: Callable[[RNS.Packet], None] | None):
def inner(receipt: RNS.PacketReceipt): def inner(receipt: RNS.PacketReceipt):
callback(packet) callback(packet)
packet.receipt.set_delivery_callback(inner if callback else None) if packet and packet.receipt:
packet.receipt.set_delivery_callback(inner if callback else None)
def get_packet_id(self, packet: RNS.Packet) -> any: def get_packet_id(self, packet: RNS.Packet) -> any:
return packet.get_hash() return packet.get_hash()