In following case, what is the correct way to unlease all leased licenses?
Background:
There’re 2 floating servers (server X and Y) on the network
There’s 1 floating client (client A) on the network
Situation:
Client A is leased a license from Server X
At some point Server X is disconnected from the network
So, now we changed Client A to use Server Y instead of Server X
Before start using Server Y, Client A tries to drop the license from Server X, but since Server X is not connected to the network, Client A cannot drop the license.
In this case, if Client A change its configuration to use Server Y, Client A will keep two of licenses leased (one from Server X and the other one from Server Y)
When Server X is connected back to the network, I believe Server X will lease the license to Client A, as Client A did not drop license before changing Server Y.
So, to avoid such case, somehow I want to flush all internal leased license inside of Client A, before changing its configuration to Server Y. So, once Server X unleased the license upon leasing time ends, the license will not be leased back to Client A anymore.
I believe GlobalClenaUp will not clean up leased license.
Should I close the process once and restart to clean up all leased licenses?
What would be a proper way to clean up leased license info in such case.
Just calling DropLicense() would be enough, because irrespective of whether it fails or succeeds, the license handle is invalidated. So the thread which automatically refreshes the license won’t send a lease refresh request to Server X, as DropLicense() invalidated the license handle.
I tested more and I encountered the case GetHandle kept returning error (error code 13) case after changing ProductFile. Once got into this state, I need to terminate the process to recover from the state.
You can only use one product file per process. Why are you using a different product file for the second server, when it is actually a backup server for the first.