Explorar o código

Revert "EXPERIMENTAL: let write update only the variant in the single-threaded case"

This reverts commit 57999d0418cd3f6119599b93c06a370e2da04ace.
Stasik0 %!s(int64=10) %!d(string=hai) anos
pai
achega
fff56acfa1
Modificáronse 1 ficheiros con 4 adicións e 18 borrados
  1. 4 18
      src/server/ua_services_attribute.c

+ 4 - 18
src/server/ua_services_attribute.c

@@ -515,10 +515,8 @@ static UA_StatusCode writeValue(UA_Server *server, UA_WriteValue *wvalue) {
                 }
             }
 
-            UA_VariableNode *newVn = UA_NULL;
-#ifndef ENABLE_MULTITHREADING
             /* copy the node */
-            newVn = (node->nodeClass == UA_NODECLASS_VARIABLE) ?
+            UA_VariableNode *newVn = (node->nodeClass == UA_NODECLASS_VARIABLE) ?
                 UA_VariableNode_new() : (UA_VariableNode*)UA_VariableTypeNode_new();
             if(!newVn) {
                 retval = UA_STATUSCODE_BADOUTOFMEMORY;
@@ -528,10 +526,7 @@ static UA_StatusCode writeValue(UA_Server *server, UA_WriteValue *wvalue) {
                 UA_VariableTypeNode_copy((const UA_VariableTypeNode*)vn, (UA_VariableTypeNode*)newVn);
             if(retval != UA_STATUSCODE_GOOD)
                 goto clean_up;
-#else
-            //no copy if no multi-threading is used
-            newVn = vn;
-#endif
+                
             /* insert the new value */
             if(hasRange)
                 retval = UA_Variant_setRangeCopy(&newVn->value.variant, wvalue->value.value.data,
@@ -541,26 +536,17 @@ static UA_StatusCode writeValue(UA_Server *server, UA_WriteValue *wvalue) {
                 retval = UA_Variant_copy(&wvalue->value.value, &newVn->value.variant);
             }
 
-            if(retval == UA_STATUSCODE_GOOD) {
-#ifndef ENABLE_MULTITHREADING
-                //do not replace the node if no multi-threading is used
-                if(UA_NodeStore_replace(server->nodestore, node,
-                                     (UA_Node*)newVn, UA_NULL) == UA_STATUSCODE_GOOD){
-#endif
+            if(retval == UA_STATUSCODE_GOOD && UA_NodeStore_replace(server->nodestore, node,
+                                                   (UA_Node*)newVn, UA_NULL) == UA_STATUSCODE_GOOD) {
                 done = UA_TRUE;
                 goto clean_up_range;
-#ifndef ENABLE_MULTITHREADING
-                }
-#endif
             }
 
             clean_up:
-#ifndef ENABLE_MULTITHREADING
             if(node->nodeClass == UA_NODECLASS_VARIABLE)
                 UA_VariableNode_delete(newVn);
             else
                 UA_VariableTypeNode_delete((UA_VariableTypeNode*)newVn);
-#endif
             clean_up_range:
             if(hasRange)
                 UA_free(range.dimensions);