|
@@ -1,6 +1,6 @@
|
|
|
-/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
-* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
-* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
+/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
#include "ua_server_internal.h"
|
|
|
#include "ua_services.h"
|
|
@@ -439,8 +439,10 @@ static UA_StatusCode
|
|
|
readValueAttributeFromNode(UA_Server *server, const UA_VariableNode *vn, UA_DataValue *v,
|
|
|
UA_NumericRange *rangeptr) {
|
|
|
if(vn->value.data.callback.onRead) {
|
|
|
+ UA_RCU_UNLOCK();
|
|
|
vn->value.data.callback.onRead(vn->value.data.callback.handle,
|
|
|
vn->nodeId, &vn->value.data.value.value, rangeptr);
|
|
|
+ UA_RCU_LOCK();
|
|
|
#ifdef UA_ENABLE_MULTITHREADING
|
|
|
/* Reopen the node to see the changes (multithreading only) */
|
|
|
vn = (const UA_VariableNode*)UA_NodeStore_get(server->nodestore, &vn->nodeId);
|
|
@@ -461,8 +463,13 @@ readValueAttributeFromDataSource(const UA_VariableNode *vn, UA_DataValue *v,
|
|
|
return UA_STATUSCODE_BADINTERNALERROR;
|
|
|
UA_Boolean sourceTimeStamp = (timestamps == UA_TIMESTAMPSTORETURN_SOURCE ||
|
|
|
timestamps == UA_TIMESTAMPSTORETURN_BOTH);
|
|
|
- return vn->value.dataSource.read(vn->value.dataSource.handle, vn->nodeId,
|
|
|
- sourceTimeStamp, rangeptr, v);
|
|
|
+
|
|
|
+ UA_RCU_UNLOCK();
|
|
|
+ UA_StatusCode retval =
|
|
|
+ vn->value.dataSource.read(vn->value.dataSource.handle, vn->nodeId,
|
|
|
+ sourceTimeStamp, rangeptr, v);
|
|
|
+ UA_RCU_LOCK();
|
|
|
+ return retval;
|
|
|
}
|
|
|
|
|
|
static UA_StatusCode
|
|
@@ -592,15 +599,21 @@ writeValueAttribute(UA_Server *server, UA_VariableNode *node,
|
|
|
writtenNode = node; /* The node is written in-situ (TODO: this might
|
|
|
change with the nodestore plugin approach) */
|
|
|
#endif
|
|
|
- writtenNode->value.data.callback.onWrite(writtenNode->value.data.callback.handle, writtenNode->nodeId,
|
|
|
+ UA_RCU_UNLOCK();
|
|
|
+ writtenNode->value.data.callback.onWrite(writtenNode->value.data.callback.handle,
|
|
|
+ writtenNode->nodeId,
|
|
|
&writtenNode->value.data.value.value, rangeptr);
|
|
|
+ UA_RCU_LOCK();
|
|
|
}
|
|
|
} else {
|
|
|
- if(node->value.dataSource.write)
|
|
|
+ if(node->value.dataSource.write) {
|
|
|
+ UA_RCU_UNLOCK();
|
|
|
retval = node->value.dataSource.write(node->value.dataSource.handle,
|
|
|
node->nodeId, &editableValue.value, rangeptr);
|
|
|
- else
|
|
|
+ UA_RCU_LOCK();
|
|
|
+ } else {
|
|
|
retval = UA_STATUSCODE_BADWRITENOTSUPPORTED;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/* Clean up */
|