mirror of
https://github.com/markqvist/Reticulum.git
synced 2026-07-17 13:58:10 -07:00
Ensure link traffic stats consistency
This commit is contained in:
+2
-3
@@ -278,6 +278,7 @@ class Packet:
|
|||||||
:returns: A :ref:`RNS.PacketReceipt<api-packetreceipt>` instance if *create_receipt* was set to *True* when the packet was instantiated, if not returns *None*. If the packet could not be sent *False* is returned.
|
:returns: A :ref:`RNS.PacketReceipt<api-packetreceipt>` instance if *create_receipt* was set to *True* when the packet was instantiated, if not returns *None*. If the packet could not be sent *False* is returned.
|
||||||
"""
|
"""
|
||||||
if not self.sent:
|
if not self.sent:
|
||||||
|
if not self.packed: self.pack()
|
||||||
if self.destination.type == RNS.Destination.LINK:
|
if self.destination.type == RNS.Destination.LINK:
|
||||||
if self.destination.status == RNS.Link.CLOSED:
|
if self.destination.status == RNS.Link.CLOSED:
|
||||||
RNS.log("Attempt to transmit over a closed link, dropping packet", RNS.LOG_DEBUG) if RNS.sl(RNS.LOG_DEBUG) else None
|
RNS.log("Attempt to transmit over a closed link, dropping packet", RNS.LOG_DEBUG) if RNS.sl(RNS.LOG_DEBUG) else None
|
||||||
@@ -288,9 +289,7 @@ class Packet:
|
|||||||
else:
|
else:
|
||||||
self.destination.last_outbound = time.time()
|
self.destination.last_outbound = time.time()
|
||||||
self.destination.tx += 1
|
self.destination.tx += 1
|
||||||
self.destination.txbytes += len(self.data)
|
self.destination.txbytes += len(self.ciphertext)
|
||||||
|
|
||||||
if not self.packed: self.pack()
|
|
||||||
|
|
||||||
if RNS.Transport.outbound(self): return self.receipt
|
if RNS.Transport.outbound(self): return self.receipt
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user