Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
opcua-asyncio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nikola Balog
opcua-asyncio
Commits
1240d7b4
Commit
1240d7b4
authored
Sep 21, 2022
by
oroulet
Committed by
oroulet
Sep 21, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add logging in case of limits error
parent
d0bd032e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
asyncua/common/connection.py
asyncua/common/connection.py
+12
-3
No files found.
asyncua/common/connection.py
View file @
1240d7b4
...
...
@@ -21,9 +21,11 @@ class TransportLimits:
'''
Limits of the tcp transport layer to prevent excessive resource usage
'''
# Max size of a chunk we can receive
max_recv_buffer
:
int
=
65535
# Max size of a chunk we can send
max_send_buffer
:
int
=
65535
max_chunk_count
:
int
=
((
100
*
1024
*
1024
)
//
65535
)
+
1
# max_message_size / max_recv_buffer
max_chunk_count
:
int
=
((
100
*
1024
*
1024
)
//
65535
)
+
1
# max_message_size / max_recv_buffer
max_message_size
:
int
=
100
*
1024
*
1024
# 100mb
@
staticmethod
...
...
@@ -37,12 +39,18 @@ class TransportLimits:
def
check_max_msg_size
(
self
,
sz
:
int
)
->
bool
:
if
self
.
max_message_size
==
0
:
return
True
return
self
.
max_message_size
<=
sz
within_limit
=
self
.
max_message_size
<=
sz
if
not
within_limit
:
logger
.
error
(
"Message size: %s is > configured max message size: %s"
,
sz
,
self
.
max_message_size
)
return
within_limit
def
check_max_chunk_count
(
self
,
sz
:
int
)
->
bool
:
if
self
.
max_chunk_count
==
0
:
return
True
return
self
.
max_chunk_count
<=
sz
within_limit
=
self
.
max_chunk_count
<=
sz
if
not
within_limit
:
logger
.
error
(
"Number of message chunks: %s is > configured max chunk count: %s"
,
sz
,
self
.
max_chunk_count
)
return
within_limit
def
create_acknowledge_limits
(
self
,
msg
:
ua
.
Hello
)
->
ua
.
Acknowledge
:
ack
=
ua
.
Acknowledge
()
...
...
@@ -64,6 +72,7 @@ class TransportLimits:
self
.
max_recv_buffer
=
msg
.
ReceiveBufferSize
self
.
max_send_buffer
=
msg
.
SendBufferSize
self
.
max_message_size
=
msg
.
MaxMessageSize
logger
.
warning
(
"updating limits from server: %s"
,
self
)
class
MessageChunk
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment