Fixed missing check for zero-length packets on IFAC-enabled interfaces. Fixes #65.

This commit is contained in:
Mark Qvist 2022-06-11 18:52:26 +02:00
parent 214ee9d771
commit 2685e043ea
2 changed files with 27 additions and 38 deletions

View File

@ -26,7 +26,6 @@ import time
import math
import struct
import threading
import traceback
from time import sleep
from .vendor import umsgpack as umsgpack
@ -285,9 +284,6 @@ class Transport:
outgoing = []
Transport.jobs_running = True
# TODO: Remove at some point
# start_time = time.time()
try:
if not Transport.jobs_locked:
# Process receipts list for timed-out packets
@ -508,17 +504,9 @@ class Transport:
except Exception as e:
RNS.log("An exception occurred while running Transport jobs.", RNS.LOG_ERROR)
RNS.log("The contained exception was: "+str(e), RNS.LOG_ERROR)
traceback.print_exc()
Transport.jobs_running = False
# TODO: Remove at some point
# end_time = time.time()
# if RNS.loglevel >= RNS.LOG_EXTREME:
# duration = round((end_time - start_time) * 1000, 2)
# if duration > 1:
# RNS.log("Transport jobs took "+str(duration)+"ms", RNS.LOG_EXTREME)
for packet in outgoing:
packet.send()
@ -822,6 +810,7 @@ class Transport:
def inbound(raw, interface=None):
# If interface access codes are enabled,
# we must authenticate each packet.
if len(raw) > 1:
if interface != None and hasattr(interface, "ifac_identity") and interface.ifac_identity != None:
# Check that IFAC flag is set
if raw[0] & 0x80 == 0x80: