mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
ARQ WIP - data event on IRS
This commit is contained in:
parent
424f4738c5
commit
e40ff05190
2 changed files with 7 additions and 3 deletions
|
@ -179,7 +179,7 @@ class ARQSessionIRS(arq_session.ARQSession):
|
||||||
self.log("ACK sent")
|
self.log("ACK sent")
|
||||||
self.set_state(IRS_State.ENDED)
|
self.set_state(IRS_State.ENDED)
|
||||||
self.event_manager.send_arq_session_finished(
|
self.event_manager.send_arq_session_finished(
|
||||||
False, self.id, self.dxcall, self.total_length, True, self.state.name)
|
False, self.id, self.dxcall, self.total_length, True, self.state.name, data=self.received_data)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import base64
|
||||||
import json
|
import json
|
||||||
import structlog
|
import structlog
|
||||||
|
|
||||||
|
@ -53,7 +54,9 @@ class EventManager:
|
||||||
}
|
}
|
||||||
self.broadcast(event)
|
self.broadcast(event)
|
||||||
|
|
||||||
def send_arq_session_finished(self, outbound: bool, session_id, dxcall, total_bytes, success: bool, state):
|
def send_arq_session_finished(self, outbound: bool, session_id, dxcall, total_bytes, success: bool, state, data=False):
|
||||||
|
if data:
|
||||||
|
data = base64.b64encode(data).decode("UTF-8")
|
||||||
direction = 'outbound' if outbound else 'inbound'
|
direction = 'outbound' if outbound else 'inbound'
|
||||||
event = {
|
event = {
|
||||||
f"arq-transfer-{direction}": {
|
f"arq-transfer-{direction}": {
|
||||||
|
@ -62,6 +65,7 @@ class EventManager:
|
||||||
'total_bytes': total_bytes,
|
'total_bytes': total_bytes,
|
||||||
'success': success,
|
'success': success,
|
||||||
'state': state,
|
'state': state,
|
||||||
|
'data': data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.broadcast(event)
|
self.broadcast(event)
|
Loading…
Reference in a new issue