diff --git a/src/pubsub/ua_pubsub_reader.c b/src/pubsub/ua_pubsub_reader.c index 9eb28711a99..0d58a89a3d9 100644 --- a/src/pubsub/ua_pubsub_reader.c +++ b/src/pubsub/ua_pubsub_reader.c @@ -848,17 +848,6 @@ UA_DataSetReader_process(UA_Server *server, UA_ReaderGroup *rg, UA_LOG_DEBUG_READER(server->config.logging, dsr, "Received a network message"); -#ifdef UA_ENABLE_PUBSUB_MONITORING - UA_DataSetReader_checkMessageReceiveTimeout(server, dsr); -#endif - - if(dsr->state != UA_PUBSUBSTATE_OPERATIONAL && - dsr->state != UA_PUBSUBSTATE_PREOPERATIONAL) { - UA_LOG_WARNING_READER(server->config.logging, dsr, - "Received a network message but not operational"); - return; - } - if(!msg->header.dataSetMessageValid) { UA_LOG_INFO_READER(server->config.logging, dsr, "DataSetMessage is discarded: message is not valid"); @@ -882,6 +871,17 @@ UA_DataSetReader_process(UA_Server *server, UA_ReaderGroup *rg, return; } +#ifdef UA_ENABLE_PUBSUB_MONITORING + UA_DataSetReader_checkMessageReceiveTimeout(server, dsr); +#endif + + if(dsr->state != UA_PUBSUBSTATE_OPERATIONAL && + dsr->state != UA_PUBSUBSTATE_PREOPERATIONAL) { + UA_LOG_WARNING_READER(server->config.logging, dsr, + "Received a network message but not operational"); + return; + } + /* Process message with raw encoding. We have no field-count information for * the message. */ if(msg->header.fieldEncoding == UA_FIELDENCODING_RAWDATA) {