ID:139291
 
Code:
mob/proc/
Mob_TimerTick()
{
Proc_DebugOutput("Mob_TimerTick() - [src]");
Mob_SendServerTimeToClient();

spawn(600)
{
Mob_TimerTick();
}
}


Problem description:
I've got a function which calls itself once every 60 seconds. If the user logs out, this looping function continues to run and src continues to appear valid. I thought I had this scenario covered by performing a del(src) at Logout() but the del(src) appears to be causing a crash. Maybe this looping function is related to this crash?

Regardless, I wanted to get some best practice feedback for how to handle an infinite loop and users logging out.
try putting it in client/Del()
while(src) instead of a recursive loop?
If src is remaining valid, and you can't delete the src in Logout(), perhaps check src.client/key.
Tsfreaks wrote:
I thought I had this scenario covered by performing a del(src) at Logout() but the del(src) appears to be causing a crash. Maybe this looping function is related to this crash?

Nope.