Remove outdated servers registered using RegisterServers2
Description
In current implementation of RegisterServers2, there is no timeout on each registered server as required by the OPC UA specification part 4 (see §5.4.5)
Code version identification
This is true in current master branch (see commit 86da971598b21a33ccee5222732f96959ef4e34a).
Current behavior
When FindServer and FindServerOnNetwork services are called, all servers descriptions are returned, even though they are not registered for more than 10 minutes.
Expected behavior
When a server is offline for more than 10 minutes (default value), its description shall be removed from server list.
Security impact
No cybersecurity impact is identified.
Implementation
The following modifications are planned:
- add a time ref in registerserver2 specification to store the expiration time (get_target_TimeReference with the delay as argument)
- add an operation to iterate over server list and remove outdated servers. For the comparison, use get_current_TimeReference to get the current time and use TimeReference_IsLessThan to compare with expiration time on each listed server).
- the iterator used for this function can be written in a specific module _it
- this operation is executed when services
FindServerandFindServerOnNetworkare called - a constant which default value is 10 minutes shall be defined in the clientserver specific constant file constants_bs (for the B part). Add in sopc_toolkit_config_constants.h a SOPC_REGISTERED_SERVER_EXPIRATION_DELAY_SECS (in seconds)
- Warning on the deletion from the server list during iteration. Iterate to create a list of servers to remove (create a variable). And then a second iteration for effective deletion. Separate the iterators in two different modules (_bs for the second one).
Edited by Vincent Lacroix