perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Kobes <ra...@theoryx5.uwinnipeg.ca>
Subject Re: The mod_perl protocol handler sample code have some problem!
Date Mon, 01 Aug 2005 05:31:50 GMT
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

Mime
View raw message