Lease expiry issue

I am using TurboFloat server on Windows7 locally (127.0.0.1)

When I first try to check for license and it works fine.

hr = TF_RequestLease(tfHandle);

hr returns "0".

My Lease is set to 300 seconds. I check on the server log and found that lease is auto renewed about mid way before lease expires.

However as part of my flow, my code will check for license again...

this time round, hr returns "6" which means "TF_E_LEASE_EXISTS" which is fine.

But I found that from this point onwards, the lease will never gets automatically renewed anymore, it will then expires.

Is this the expected behavior?

Linus

ok... i managed to get around it....

the culprit is actually TF_SaveServer

If there is already an existing lease, calling this function again will cause the problem I described.

My solution is this... I added a check to see if lease exists, if it does, I just return from my regular license check function.

hr = TF_HasLease(tfHandle); if (hr == TF_OK) { return; }

So you're calling "TF_SaveServer()" when you already have a lease? We'll look into this -- we should probably just drop the lease immediately if you do this.

Also, why are you "polling" if you have a lease? That's what the callback is for -- it tells you when you no longer have a lease.

Hi Wyatt,

Ironically, it is to handle lease expiring.

When lease expired, the callback did get triggered. In our use case, we do not want to immediately try to regain the license until the user click on the GUI. So, when the callback occurs, we remember it. When the user click on the GUI, we will then get a new lease. The problem is, my original code will have a case where we request for a new lease when a lease already exists.

Think of the case where the PC is suspended after work, we want to gracefully reacquire lease when the engineer comes back to work the next day without any intervention.

Linus