On Tue, 04 Feb 2003 22:33:13 +0200, Shahar Evron wrote:
> this peace of code seems to generate an infinite loop, and i have no
> clue why. this may very well be for a very silly reason, but i'm clueless...
>
>> while (1) {
>> if ($ntries >= 4) {
>> print ERRLOG "Error : failed $ntries login attempts - giving
>up.\n";
>> return 2; }
>>
>> sleep (30*$ntries*$ntries) if ($ntries > 0);
>> $ntries++;
>> }
It's not an endless loop, only a very long during loop.
$ntries is counts from 0 .. 3 (at 4 there's a return).
If e.g. $ntries is 3 then you have a call
sleep(30*3*3) = sleep(270) what means that the program
waits 4 and half minutes!
If you change the sleeping time e.g. to sleep($ntries*$ntries)
you'll see that the loop stops.
Best Wishes,
Janek
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]