mirror of https://github.com/DJ2LS/FreeDATA.git
work on heartbeat
parent
81f500802d
commit
ec4a8c90e2
|
@ -326,16 +326,12 @@ class P2PConnection:
|
|||
def transmit_heartbeat_ack(self):
|
||||
print("transmit heartbeat ack")
|
||||
|
||||
if self.p2p_data_tx_queue.empty():
|
||||
self.flag_buffer_empty = True
|
||||
|
||||
|
||||
self.flag_buffer_empty = self.p2p_data_tx_queue.empty()
|
||||
self.last_data_timestamp = time.time()
|
||||
heartbeat_ack = self.frame_factory.build_p2p_connection_heartbeat_ack(self.session_id, flag_buffer_empty=self.flag_buffer_empty,flag_announce_arq=self.flag_announce_arq)
|
||||
print(heartbeat_ack)
|
||||
self.launch_twr_irs(heartbeat_ack, self.ENTIRE_CONNECTION_TIMEOUT, mode=FREEDV_MODE.signalling)
|
||||
|
||||
|
||||
def received_heartbeat(self, frame):
|
||||
print("received heartbeat...")
|
||||
self.last_data_timestamp = time.time()
|
||||
|
@ -363,9 +359,13 @@ class P2PConnection:
|
|||
print("received heartbeat ack from IRS...")
|
||||
buffer_empty_flag = frame.get('flag', {}).get('BUFFER_EMPTY', False)
|
||||
announce_arq_flag = frame.get('flag', {}).get('ANNOUNCE_ARQ', False)
|
||||
|
||||
if buffer_empty_flag:
|
||||
print("other stations buffer is empty. We can become data master now")
|
||||
self.is_Master = True
|
||||
else:
|
||||
print("other station has data to be sent...")
|
||||
self.is_Master = False
|
||||
|
||||
if announce_arq_flag:
|
||||
print("other station announced arq, changing state")
|
||||
|
|
Loading…
Reference in New Issue