From 67bd88fdb85aa359c99e8b812e80c73b006fab69 Mon Sep 17 00:00:00 2001 From: Christian Bergmiller Date: Fri, 26 Jul 2019 12:36:36 +0200 Subject: [PATCH] make add_method_callback sync --- asyncua/common/manage_nodes.py | 2 +- asyncua/server/internal_session.py | 2 +- asyncua/server/server.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/asyncua/common/manage_nodes.py b/asyncua/common/manage_nodes.py index 53bd65d8..66fdf65a 100644 --- a/asyncua/common/manage_nodes.py +++ b/asyncua/common/manage_nodes.py @@ -371,7 +371,7 @@ async def _create_method(parent, nodeid, qname, callback, inputs, outputs): datatype=ua.ObjectIds.Argument ) if hasattr(parent.server, "add_method_callback"): - await parent.server.add_method_callback(method.nodeid, callback) + parent.server.add_method_callback(method.nodeid, callback) return results[0].AddedNodeId diff --git a/asyncua/server/internal_session.py b/asyncua/server/internal_session.py index a477185a..a8fa514f 100644 --- a/asyncua/server/internal_session.py +++ b/asyncua/server/internal_session.py @@ -111,7 +111,7 @@ class InternalSession: async def delete_references(self, params): return self.iserver.node_mgt_service.delete_references(params, self.user) - async def add_method_callback(self, methodid, callback): + def add_method_callback(self, methodid, callback): return self.aspace.add_method_callback(methodid, callback) def call(self, params): diff --git a/asyncua/server/server.py b/asyncua/server/server.py index 91275d29..c00fd1f4 100644 --- a/asyncua/server/server.py +++ b/asyncua/server/server.py @@ -555,14 +555,14 @@ class Server: def unsubscribe_server_callback(self, event, handle): self.iserver.unsubscribe_server_callback(event, handle) - async def link_method(self, node, callback): + def link_method(self, node, callback): """ Link a python function to a UA method in the address space; required when a UA method has been imported to the address space via XML; the python executable must be linked manually :param node: UA method node :param callback: python function that the UA method will call """ - await self.iserver.isession.add_method_callback(node.nodeid, callback) + self.iserver.isession.add_method_callback(node.nodeid, callback) def load_type_definitions(self, nodes=None) -> Coroutine: """