Author: stas Date: Tue Apr 5 09:34:54 2005 New Revision: 160197 URL: http://svn.apache.org/viewcvs?view=rev&rev=160197 Log: make sure that the sockets are blocking
Modified: perl/modperl/trunk/t/protocol/TestProtocol/eliza.pm Modified: perl/modperl/trunk/t/protocol/TestProtocol/eliza.pm URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/protocol/TestProtocol/eliza.pm?view=diff&r1=160196&r2=160197 ============================================================================== --- perl/modperl/trunk/t/protocol/TestProtocol/eliza.pm (original) +++ perl/modperl/trunk/t/protocol/TestProtocol/eliza.pm Tue Apr 5 09:34:54 2005 @@ -18,6 +18,17 @@ my Apache2::Connection $c = shift; my APR::Socket $socket = $c->client_socket; + # starting from Apache 2.0.49 several platforms require you to set + # the socket to a blocking IO mode + my $nonblocking = $socket->opt_get(APR::Const::SO_NONBLOCK); + if ($nonblocking) { + $socket->opt_set(APR::Const::SO_NONBLOCK, 0); + + # test that we really *are* in the blocking mode + !$socket->opt_get(APR::Const::SO_NONBLOCK) + or die "failed to set blocking mode"; + } + my $last = 0; while ($socket->recv(my $buff, BUFF_LEN)) { # \r is sent instead of \n if the client is talking over telnet