Joe Orton wrote:
On Wed, Apr 07, 2004 at 01:44:23PM -0700, Stas Bekman wrote:

Joe Orton wrote:

The issue with the echo.t test on Solaris is that the socket is in
non-blocking mode on the server, so on the second recv() the server just
returns EINTR as there's no data available.

Coolio, Joe. So should we set some socket args to make it blocking before calling recv()?


Yeah, I reckon so. Fixes echo.t on Solaris and still works on Linux:

--- t/protocol/TestProtocol/echo.pm 11 Apr 2002 11:08:43 -0000 1.2
+++ t/protocol/TestProtocol/echo.pm 7 Apr 2004 20:50:55 -0000
@@ -7,6 +7,7 @@
use APR::Socket ();
use Apache::Const -compile => 'OK';
+use APR::Const -compile => qw(:socket);
use constant BUFF_LEN => 1024;
@@ -15,6 +16,8 @@
my APR::Socket $socket = $c->client_socket;
my $buff;
+
+ $socket->opt_set(APR::SO_NONBLOCK, 0);
for (;;) {
my($rlen, $wlen);

joe++


And we get to exercise socket functions, which is nice!

I'll add a comment, so we don't forget why we do that.

# on some platforms (OSX/Solaris) httpd hands us a non-blocking socket

It's funny how you need to set a nonblocking option to zero to get the blocking effect.

but... the fact that this works on Linux means that the socket has been
left in blocking mode there, and it shouldn't be AFAIK, so I'm confused about that.

Nothing on the modperl side, that's what httpd gives to us.


Hmmm, right. It's supposed to be like that.  You get a non-blocking
socket on some platforms, and a blocking socket on others.  Screwy, eh?

Not very friendly to a developer who gets to access on a specific platform. Is this documented somewhere?


But for echo_filter.pm, the ap_brigade_get() is being passed
AP_BLOCK_READ by default, so now I'll go and find out why that doesn't
work as you'd expect...

cool! looks like we need to load:


use Apache::Filter ();

as well.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to