Client wrapper state machine: remove global counters limited by maximum value
Description
In the client wrapper state machine, a global counter nSentReqs
is used to generate unique ids and also to generate client handle value for MonitoredItem. This counter might cause error in client wrapper state machine if it reaches the maximum value (INT32_MAX).
In a similar way the global counter nPublishReqs
may lead to error when reaching maximum value (UINTPTR_MAX).
Analysis
nSentReqs
should not be used to generate client handle value for MonitoredItem since it is not dedicated nor documented to generate client handles. Moreover it is possible to use a counter inside the state machine structure which is protected by mutexes and avoid atomic increments instead.
Unique identifiers generated by nSentReqs
are not necessary since we already use context pointer address to check the context is known. And unique identifiers generated by nPublishReqs
as context are never used in PublishResponse treatment.
Therefore both global counters could be removed.