Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ebpfCAT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
karaboDevices
ebpfCAT
Commits
9f05d0ad
Commit
9f05d0ad
authored
4 years ago
by
Martin Teichmann
Browse files
Options
Downloads
Patches
Plain Diff
make MAXSIZE a named constant
parent
5bdbdbad
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ethercat.py
+3
-1
3 additions, 1 deletion
ethercat.py
with
3 additions
and
1 deletion
ethercat.py
+
3
−
1
View file @
9f05d0ad
...
...
@@ -2,6 +2,8 @@ from asyncio import ensure_future, Event, Future, gather, get_event_loop, Protoc
from
socket
import
socket
,
AF_PACKET
,
SOCK_DGRAM
from
struct
import
pack
,
unpack
,
calcsize
MAXSIZE
=
1000
# maximum size we use for an EtherCAT packet
class
AsyncBase
:
async
def
__new__
(
cls
,
*
args
,
**
kwargs
):
...
...
@@ -23,7 +25,7 @@ class EtherCat(Protocol, AsyncBase):
size
=
2
while
True
:
*
dgram
,
data
,
future
=
await
self
.
send_queue
.
get
()
done
=
size
>
1000
or
self
.
send_queue
.
empty
()
done
=
size
>
MAXSIZE
or
self
.
send_queue
.
empty
()
ret
.
append
(
pack
(
"
<BBhHHH
"
,
*
dgram
,
len
(
data
)
|
((
not
done
)
<<
15
),
0
))
ret
.
append
(
data
)
...
...
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