Joe Schaefer wrote:
Sorry, I've pasted the old examples without updating them. Here is a diff against the current test (just one for now):
Index: t/protocol/TestProtocol/echo_bbs2.pm =================================================================== --- t/protocol/TestProtocol/echo_bbs2.pm (revision 109678) +++ t/protocol/TestProtocol/echo_bbs2.pm (working copy) @@ -1,3 +1,4 @@ + package TestProtocol::echo_bbs2;
# similar to TestProtocol::echo_bbs but here re-using one bucket @@ -4,11 +5,6 @@ # brigade for input and output, using flatten to slurp all the data in # the bucket brigade, and cleanup to get rid of the old buckets
-# XXX: ideally $bb->cleanup should be used here and no create/destroy -# bb every time the loop is entered should be done. But it segfaults -# on certain setups: -# http://marc.theaimsgroup.com/?l=apache-modperl-dev&m=108967266419527&w=2 - use strict; use warnings FATAL => 'all';
@@ -28,11 +24,11 @@
# the socket to a blocking IO mode
$c->client_socket->opt_set(APR::SO_NONBLOCK, 0);+ my $bb_in = APR::Brigade->new($c->pool, $c->bucket_alloc);
+ my $bb_out = APR::Brigade->new($c->pool, $c->bucket_alloc);
+
my $last = 0;
while (1) {
- my $bb_in = APR::Brigade->new($c->pool, $c->bucket_alloc);
- my $bb_out = APR::Brigade->new($c->pool, $c->bucket_alloc);
-
my $rc = $c->input_filters->get_brigade($bb_in,
Apache::MODE_GETLINE);
last if $rc == APR::EOF;
@@ -48,11 +44,14 @@$c->output_filters->fflush($bb_out);
- # XXX: add DESTROY and remove explicit calls
- $bb_in->destroy;
- $bb_out->destroy;
+ $bb_in->cleanup;
+ $bb_out->cleanup;
}+ # XXX: add DESTROY and remove explicit calls
+ $bb_in->destroy;
+ $bb_out->destroy;
+
Apache::OK;
}-- __________________________________________________________________ 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]
