Skip to content

Commit

Permalink
Merge pull request #29 from qualisys/fix_start_streaming_before_playb…
Browse files Browse the repository at this point in the history
…ack_started

Added handling for the 'NoMoreData' packet
  • Loading branch information
qjgn authored Jun 5, 2023
2 parents a7c401d + 71b9cae commit dc141fd
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions qtm/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ def __init__(self, *, loop=None, on_disconnect=None, on_event=None):
QRTPacketType.PacketCommand: self._on_command,
QRTPacketType.PacketEvent: self._on_event,
QRTPacketType.PacketXML: self._on_xml,
QRTPacketType.PacketNoMoreData: lambda _: LOG.debug(
QRTPacketType.PacketNoMoreData
),
QRTPacketType.PacketNoMoreData: self._on_no_more_data
}

self._receiver = Receiver(self._handlers)
Expand Down Expand Up @@ -151,7 +149,14 @@ def _on_data(self, packet):
else:
self._deliver_promise(packet)
return


def _on_no_more_data(self, packet):
if self.on_packet is not None:
if self._start_streaming:
self._deliver_promise(b"Ok")
self._start_streaming = False
return

def _on_event(self, event):
LOG.info(event)

Expand Down

0 comments on commit dc141fd

Please sign in to comment.