in reply to io::select bogs cpu on disconnect
When a client closes its connection or gets disconnected select() will report it as being readable. However when you actually read from it sysread will return zero. You should check the result of sysread for this condition and close the connection, but you do not. Because you do not, the select() will continue to report the handle as readable and so you have a loop that never sleeps
Re: Re: io::select bogs cpu on disconnect
by Visionary (Initiate) on Oct 03, 2001 at 23:55 UTC
|
Gbarr,
Thank you I owe you my sanity. I was only trapping the writes; not the reads. One simple line at your suggestion:
if (!$nread) {
$sel->remove($client);
}
did the trick.
Again, thanks!
Alex
PS - This is my first visit here, and it is like the holy grail I've been searching for.... You guys are great. | [reply] [d/l] |
|