Commit 96fb1eb3 authored by Alexander Schrode's avatar Alexander Schrode Committed by oroulet

fix _open_secure_channel_exchange typehints

parent 0dff796d
...@@ -39,7 +39,7 @@ class UASocketProtocol(asyncio.Protocol): ...@@ -39,7 +39,7 @@ class UASocketProtocol(asyncio.Protocol):
self.closed: bool = False self.closed: bool = False
# needed to pass params from asynchronous request to synchronous data receive callback, as well as # needed to pass params from asynchronous request to synchronous data receive callback, as well as
# passing back the processed response to the request so that it can return it. # passing back the processed response to the request so that it can return it.
self._open_secure_channel_exchange: Optional[ua.OpenSecureChannelResponse] = None self._open_secure_channel_exchange: Union[ua.OpenSecureChannelResponse, ua.OpenSecureChannelParameters, None] = None
def connection_made(self, transport: asyncio.Transport): # type: ignore def connection_made(self, transport: asyncio.Transport): # type: ignore
self.state = self.OPEN self.state = self.OPEN
...@@ -78,10 +78,11 @@ class UASocketProtocol(asyncio.Protocol): ...@@ -78,10 +78,11 @@ class UASocketProtocol(asyncio.Protocol):
msg = self._connection.receive_from_header_and_body(header, buf) msg = self._connection.receive_from_header_and_body(header, buf)
self._process_received_message(msg) self._process_received_message(msg)
if header.MessageType == ua.MessageType.SecureOpen: if header.MessageType == ua.MessageType.SecureOpen:
params = self._open_secure_channel_exchange params: ua.OpenSecureChannelParameters = self._open_secure_channel_exchange
self._open_secure_channel_exchange = struct_from_binary(ua.OpenSecureChannelResponse, msg.body()) response: ua.OpenSecureChannelResponse = struct_from_binary(ua.OpenSecureChannelResponse, msg.body())
self._open_secure_channel_exchange.ResponseHeader.ServiceResult.check() # type: ignore response.ResponseHeader.ServiceResult.check()
self._connection.set_channel(self._open_secure_channel_exchange.Parameters, params.RequestType, params.ClientNonce) # type: ignore self._open_secure_channel_exchange = response
self._connection.set_channel(response.Parameters, params.RequestType, params.ClientNonce)
if not buf: if not buf:
return return
# Buffer still has bytes left, try to process again # Buffer still has bytes left, try to process again
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment