Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tango
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
tango
Commits
f2d826b5
Commit
f2d826b5
authored
Mar 21, 2022
by
Jan David Mol
Browse files
Options
Downloads
Patches
Plain Diff
L2SS-676
: Fully support different packet header lengths, avoid parsing a packet multiple times.
parent
88edf029
No related branches found
No related tags found
1 merge request
!266
L2SS-676: Support parsing beamlet packets
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tangostationcontrol/tangostationcontrol/devices/sdp/packet.py
+13
-7
13 additions, 7 deletions
...ostationcontrol/tangostationcontrol/devices/sdp/packet.py
with
13 additions
and
7 deletions
tangostationcontrol/tangostationcontrol/devices/sdp/packet.py
+
13
−
7
View file @
f2d826b5
...
...
@@ -499,16 +499,22 @@ def read_packet(read_func) -> SDPPacket:
If read_func() returns None, this function will as well.
"""
# read just the
head
er
head
er
=
read_func
(
SDPPacket
.
header_size
)
if
not
head
er
:
# read just the
mark
er
mark
er
=
read_func
(
1
)
if
not
mark
er
:
return
None
# marker is the first byte of the header
marker
=
header
[
0
]
# read the packet header based on type
packetClass
=
PACKET_CLASS_FOR_MARKER
[
marker
]
# read the rest of the header
header
=
read_func
(
packetClass
.
header_size
-
len
(
marker
))
if
not
header
:
return
None
header
=
marker
+
header
# parse the packet header size
packet
=
packetClass
(
header
)
# read the payload
...
...
@@ -534,7 +540,7 @@ def main(args=None, **kwargs):
offset
=
0
while
True
:
# read
just the header
# read
the packet from input
packet
=
read_packet
(
sys
.
stdin
.
buffer
.
read
)
# print header
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment