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
ce818bd1
Commit
ce818bd1
authored
Jan 02, 2020
by
oroulet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
@Phlogistique: handle revised session_timeout
parent
e80d69b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
asyncua/client/client.py
asyncua/client/client.py
+12
-4
No files found.
asyncua/client/client.py
View file @
ce818bd1
...
...
@@ -38,8 +38,11 @@ class Client:
:param timeout:
Each request sent to the server expects an answer within this
time. The timeout is specified in seconds.
Some other client parameters can be changed by setting
attributes on the constructed object:
See the source code for the exhaustive list.
"""
_logger
=
logging
.
getLogger
(
__name__
)
self
.
loop
=
loop
or
asyncio
.
get_event_loop
()
self
.
server_url
=
urlparse
(
url
)
# take initial username and password from the url
...
...
@@ -73,6 +76,7 @@ class Client:
def
__str__
(
self
):
return
f"Client(
{
self
.
server_url
.
geturl
()
}
)"
__repr__
=
__str__
@
staticmethod
...
...
@@ -257,7 +261,9 @@ class Client:
# length should be equal to the length of key of symmetric encryption
params
.
ClientNonce
=
create_nonce
(
self
.
security_policy
.
symmetric_key_size
)
result
=
await
self
.
uaclient
.
open_secure_channel
(
params
)
self
.
secure_channel_timeout
=
result
.
SecurityToken
.
RevisedLifetime
if
self
.
secure_channel_timeout
!=
result
.
SecurityToken
.
RevisedLifetime
:
_logger
.
info
(
"Requested secure channel timeout to be %dms, got %dms instead"
,
self
.
secure_channel_timeout
,
result
.
SecurityToken
.
RevisedLifetime
)
self
.
secure_channel_timeout
=
result
.
SecurityToken
.
RevisedLifetime
async
def
close_secure_channel
(
self
):
return
await
self
.
uaclient
.
close_secure_channel
()
...
...
@@ -323,7 +329,7 @@ class Client:
params
.
EndpointUrl
=
self
.
server_url
.
geturl
()
params
.
SessionName
=
f"
{
self
.
description
}
Session
{
self
.
_session_counter
}
"
# Requested maximum number of milliseconds that a Session should remain open without activity
params
.
RequestedSessionTimeout
=
60
*
60
*
1000
params
.
RequestedSessionTimeout
=
self
.
session_timeout
params
.
MaxResponseMessageSize
=
0
# means no max size
response
=
await
self
.
uaclient
.
create_session
(
params
)
if
self
.
security_policy
.
client_certificate
is
None
:
...
...
@@ -340,7 +346,9 @@ class Client:
ep
=
Client
.
find_endpoint
(
response
.
ServerEndpoints
,
self
.
security_policy
.
Mode
,
self
.
security_policy
.
URI
)
self
.
_policy_ids
=
ep
.
UserIdentityTokens
# Actual maximum number of milliseconds that a Session shall remain open without activity
self
.
session_timeout
=
response
.
RevisedSessionTimeout
if
self
.
session_timeout
!=
response
.
RevisedSessionTimeout
:
_logger
.
warning
(
"Requested session timeout to be %dms, got %dms instead"
,
self
.
secure_channel_timeout
,
response
.
RevisedSessionTimeout
)
self
.
session_timeout
=
response
.
RevisedSessionTimeout
self
.
_renew_channel_task
=
self
.
loop
.
create_task
(
self
.
_renew_channel_loop
())
return
response
...
...
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