Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/1.4' into merge_13_14_17
Browse files Browse the repository at this point in the history
  • Loading branch information
jpfr committed Oct 2, 2024
2 parents 1c261de + c166551 commit 68e75c7
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion src/client/ua_client_connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ signActivateSessionRequest(UA_Client *client, UA_SecureChannel *channel,
UA_ByteString signData = UA_BYTESTRING_NULL;
size_t signDataSize =
channel->remoteCertificate.length + client->serverSessionNonce.length;
if(dataToSignSize > MAX_DATA_SIZE) {
if(signDataSize > MAX_DATA_SIZE) {
retval = UA_STATUSCODE_BADINTERNALERROR;
goto cleanup;
}
Expand Down
2 changes: 2 additions & 0 deletions src/pubsub/ua_pubsub.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ typedef struct UA_PubSubConnection {

UA_UInt16 configurationFreezeCounter;

UA_DateTime silenceErrorUntil; /* Avoid generating too many logs */

UA_Boolean deleteFlag; /* To be deleted - in addition to the PubSubState */
UA_DelayedCallback dc; /* For delayed freeing */
} UA_PubSubConnection;
Expand Down
11 changes: 8 additions & 3 deletions src/pubsub/ua_pubsub_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,14 @@ decodeNetworkMessage(UA_Server *server, UA_ByteString *buffer, size_t *pos,

loops_exit:
if(!processed) {
UA_LOG_INFO_CONNECTION(server->config.logging, connection,
"Dataset reader not found. Check PublisherId, "
"WriterGroupId and DatasetWriterId");
UA_DateTime nowM = UA_DateTime_nowMonotonic();
if(connection->silenceErrorUntil < nowM) {
UA_LOG_INFO_CONNECTION(server->config.logging, connection,
"Dataset reader not found. Check PublisherId, "
"WriterGroupId and DatasetWriterId. "
"(This error is now silenced for 10s.)");
connection->silenceErrorUntil = nowM + (UA_DateTime)(10.0 * UA_DATETIME_SEC);
}
/* Possible multicast scenario: there are multiple connections (with one
* or more ReaderGroups) within a multicast group every connection
* receives all network messages, even if some of them are not meant for
Expand Down
2 changes: 0 additions & 2 deletions src/pubsub/ua_pubsub_dataset.c
Original file line number Diff line number Diff line change
Expand Up @@ -669,8 +669,6 @@ UA_PublishedDataSet_create(UA_Server *server,
result.configurationVersion.minorVersion = UA_PubSubConfigurationVersionTimeDifference();
switch(newConfig->publishedDataSetType) {
case UA_PUBSUB_DATASET_PUBLISHEDEVENTS_TEMPLATE:
res = UA_STATUSCODE_BADNOTSUPPORTED;
break;
case UA_PUBSUB_DATASET_PUBLISHEDEVENTS:
res = UA_STATUSCODE_BADNOTSUPPORTED;
break;
Expand Down
11 changes: 8 additions & 3 deletions src/pubsub/ua_pubsub_eventloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,14 @@ PubSubChannelCallback(UA_ConnectionManager *cm, uintptr_t connectionId,
}

if(!processed) {
UA_LOG_WARNING_CONNECTION(server->config.logging, psc,
"Message received that could not be processed. "
"Check PublisherID, WriterGroupID and DatasetWriterID.");
UA_DateTime nowM = UA_DateTime_nowMonotonic();
if(psc->silenceErrorUntil < nowM) {
UA_LOG_WARNING_CONNECTION(server->config.logging, psc,
"Message received that could not be processed. "
"Check PublisherID, WriterGroupID and DatasetWriterID. "
"(This error is now silenced for 10s.)");
psc->silenceErrorUntil = nowM + (UA_DateTime)(10.0 * UA_DATETIME_SEC);
}
}

UA_UNLOCK(&server->serviceMutex);
Expand Down
14 changes: 4 additions & 10 deletions src/pubsub/ua_pubsub_writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -854,21 +854,15 @@ UA_DataSetWriter_generateDataSetMessage(UA_Server *server,
if((u64)jsonDsm->dataSetMessageContentMask &
(u64)UA_JSONDATASETMESSAGECONTENTMASK_METADATAVERSION) {
dataSetMessage->header.configVersionMajorVersionEnabled = true;
if(heartbeat){
dataSetMessage->header.configVersionMajorVersion = 0;
} else {
dataSetMessage->header.configVersionMajorVersion =
currentDataSet->dataSetMetaData.configurationVersion.majorVersion;
}
}
if((u64)jsonDsm->dataSetMessageContentMask &
(u64)UA_JSONDATASETMESSAGECONTENTMASK_METADATAVERSION) {
dataSetMessage->header.configVersionMinorVersionEnabled = true;
if(heartbeat){
dataSetMessage->header.configVersionMajorVersion = 0;
dataSetMessage->header.configVersionMinorVersion = 0;
} else {
dataSetMessage->header.configVersionMajorVersion =
currentDataSet->dataSetMetaData.configurationVersion.majorVersion;
dataSetMessage->header.configVersionMinorVersion =
currentDataSet->dataSetMetaData.configurationVersion.minorVersion;
currentDataSet->dataSetMetaData.configurationVersion.minorVersion;
}
}

Expand Down
3 changes: 0 additions & 3 deletions src/server/ua_server_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ getNodeType(UA_Server *server, const UA_NodeHead *head) {
UA_Boolean inverse;
switch(head->nodeClass) {
case UA_NODECLASS_OBJECT:
parentRefIndex = UA_REFERENCETYPEINDEX_HASTYPEDEFINITION;
inverse = false;
break;
case UA_NODECLASS_VARIABLE:
parentRefIndex = UA_REFERENCETYPEINDEX_HASTYPEDEFINITION;
inverse = false;
Expand Down
12 changes: 6 additions & 6 deletions src/server/ua_services_nodemanagement.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,11 @@ typeCheckVariableNode(UA_Server *server, UA_Session *session,
}

/* Type-check the value */
if(retval == UA_STATUSCODE_GOOD &&
!compatibleValue(server, session, &node->dataType, node->valueRank,
node->arrayDimensionsSize, node->arrayDimensions,
&value.value, NULL, &reason)) {
UA_Boolean compatible =
compatibleValue(server, session, &node->dataType,
node->valueRank, node->arrayDimensionsSize,
node->arrayDimensions, &value.value, NULL, &reason);
if(!compatible) {
UA_LOG_NODEID_INFO(&node->head.nodeId,
UA_LOG_INFO_SESSION(server->config.logging, session,
"AddNode (%.*s): The VariableNode value has "
Expand Down Expand Up @@ -1587,10 +1588,9 @@ addNode_finish(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId)
}

cleanup:
UA_NODESTORE_RELEASE(server, node);
if(type)
UA_NODESTORE_RELEASE(server, type);
if(node)
UA_NODESTORE_RELEASE(server, node);
if(retval != UA_STATUSCODE_GOOD)
deleteNode(server, *nodeId, true);
return retval;
Expand Down
8 changes: 4 additions & 4 deletions src/server/ua_subscription_events_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ static UA_Ternary
UA_Ternary_and(UA_Ternary first, UA_Ternary second) {
if(first == UA_TERNARY_FALSE || second == UA_TERNARY_FALSE)
return UA_TERNARY_FALSE;
if(first == UA_TERNARY_TRUE && second == UA_TERNARY_TRUE)
return UA_TERNARY_TRUE;
return UA_TERNARY_NULL;
if(first == UA_TERNARY_NULL || second == UA_TERNARY_NULL)
return UA_TERNARY_NULL;
return UA_TERNARY_TRUE;
}

static UA_Ternary
UA_Ternary_or(UA_Ternary first, UA_Ternary second) {
if(first == UA_TERNARY_TRUE || second == UA_TERNARY_TRUE)
return UA_TERNARY_TRUE;
if(first == UA_TERNARY_NULL || second == UA_TERNARY_NULL)
return UA_TERNARY_TRUE;
return UA_TERNARY_NULL;
return UA_TERNARY_FALSE;
}

Expand Down
5 changes: 2 additions & 3 deletions src/server/ua_subscription_monitoreditem.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,9 @@ UA_Notification_enqueueAndTrigger(UA_Server *server, UA_Notification *n) {
mon->triggeredUntil > UA_DateTime_nowMonotonic())) {
UA_Notification_enqueueSub(n);
mon->triggeredUntil = UA_INT64_MIN;
UA_LOG_DEBUG_SUBSCRIPTION(server->config.logging, mon->subscription,
UA_LOG_DEBUG_SUBSCRIPTION(server->config.logging, sub,
"Notification enqueued (Queue size %lu)",
(long unsigned)mon->subscription->notificationQueueSize);
(long unsigned)sub->notificationQueueSize);
}

/* Insert into the MonitoredItem. This checks the queue size and
Expand Down Expand Up @@ -430,7 +430,6 @@ UA_Server_registerMonitoredItem(UA_Server *server, UA_MonitoredItem *mon) {
UA_Subscription *sub = mon->subscription;
if(sub) {
mon->monitoredItemId = ++sub->lastMonitoredItemId;
mon->subscription = sub;
sub->monitoredItemsSize++;
LIST_INSERT_HEAD(&sub->monitoredItems, mon, listEntry);
} else {
Expand Down

0 comments on commit 68e75c7

Please sign in to comment.