Avoid setting global / class state for unrelated frame.

This commit is contained in:
Paul Kronenwetter 2022-07-02 16:20:14 -04:00
parent 06c11e0537
commit 953e981e18

View file

@ -1813,10 +1813,10 @@ class DATA:
data_in:bytes: data_in:bytes:
""" """
static.DXCALLSIGN_CRC = bytes(data_in[4:7]) dxcallsign_CRC = bytes(data_in[4:7])
static.DXCALLSIGN = helpers.bytes_to_callsign(bytes(data_in[7:13])) dxcallsign = helpers.bytes_to_callsign(bytes(data_in[7:13]))
helpers.add_to_heard_stations( helpers.add_to_heard_stations(
static.DXCALLSIGN, dxcallsign,
static.DXGRID, static.DXGRID,
"PING", "PING",
static.SNR, static.SNR,
@ -1830,7 +1830,7 @@ class DATA:
uuid=str(uuid.uuid4()), uuid=str(uuid.uuid4()),
timestamp=int(time.time()), timestamp=int(time.time()),
mycallsign=str(self.mycallsign, "UTF-8"), mycallsign=str(self.mycallsign, "UTF-8"),
dxcallsign=str(static.DXCALLSIGN, "UTF-8"), dxcallsign=str(dxcallsign, "UTF-8"),
dxgrid=str(static.DXGRID, "UTF-8"), dxgrid=str(static.DXGRID, "UTF-8"),
snr=str(static.SNR), snr=str(static.SNR),
) )
@ -1841,6 +1841,8 @@ class DATA:
self.log.debug("[TNC] received_ping: ping not for this station.") self.log.debug("[TNC] received_ping: ping not for this station.")
return return
static.DXCALLSIGN_CRC = dxcallsign_CRC
static.DXCALLSIGN = dxcallsign
self.log.info( self.log.info(
"[TNC] PING REQ [" "[TNC] PING REQ ["
+ str(mycallsign, "UTF-8") + str(mycallsign, "UTF-8")