On Sun, 31 Jul 2005, Randy Kobes wrote:
On Sun, 31 Jul 2005, Randy Kobes wrote:
[ ... ]
Here's a scaled-down version of the problem - I used
commands with single letters, as my Win32 console sent a \r\n after each
letter.
[ ... ]
sub handler {
my $c = shift;
$| = 1;
my $socket = $c->client_socket;
$socket->opt_set(APR::Const::SO_NONBLOCK, 0);
$socket->send("Welcome to " . __PACKAGE__ .
"\r\nAvailable commands: @cmds\r\n");
while (1) {
my $cmd;
next unless $cmd = getline($socket);
[ ... ]
I found that if I change that last line to
last unless $cmd = getline($socket);
then one can interrupt the telnet session with 'CTRL ]'
and close the connection without the Apache process
consuming 100% cpu.
--
best regards,
randy