You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by st...@apache.org on 2004/07/14 10:42:07 UTC
cvs commit: modperl-2.0/t/protocol/TestProtocol echo_bbs2.pm
stas 2004/07/14 01:42:07
Modified: todo release
t/protocol/TestProtocol echo_bbs2.pm
Log:
temporary commit the implementation that doesn't use $bb->cleanup, which
fails on certain setups
Revision Changes Path
1.32 +3 -0 modperl-2.0/todo/release
Index: release
===================================================================
RCS file: /home/cvs/modperl-2.0/todo/release,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -u -r1.31 -r1.32
--- release 13 Jul 2004 03:59:46 -0000 1.31
+++ release 14 Jul 2004 08:42:07 -0000 1.32
@@ -4,6 +4,9 @@
-- see also todo/api_status
+* $bb->cleanup segfaults (originally in TestProtocol::echo_bbs2
+ http://marc.theaimsgroup.com/?l=apache-modperl-dev&m=108967266419527&w=2
+
* the following methods/functions are using compat implementations in
tests and should use the real 2.0 API: method_register,
server_root_relative
1.6 +13 -7 modperl-2.0/t/protocol/TestProtocol/echo_bbs2.pm
Index: echo_bbs2.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/protocol/TestProtocol/echo_bbs2.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -u -r1.5 -r1.6
--- echo_bbs2.pm 1 Jul 2004 02:01:21 -0000 1.5
+++ echo_bbs2.pm 14 Jul 2004 08:42:07 -0000 1.6
@@ -4,6 +4,11 @@
# 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';
@@ -23,29 +28,30 @@
# the socket to a blocking IO mode
$c->client_socket->opt_set(APR::SO_NONBLOCK, 0);
- my $bb = 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;
die APR::Error::strerror($rc) unless $rc == APR::SUCCESS;
next unless $bb_in->flatten(my $data);
- $bb->cleanup;
#warn "read: [$data]\n";
last if $data =~ /^[\r\n]+$/;
# transform data here
my $bucket = APR::Bucket->new(uc $data);
- $bb->insert_tail($bucket);
+ $bb_out->insert_tail($bucket);
- $c->output_filters->fflush($bb);
- }
+ $c->output_filters->fflush($bb_out);
- $bb->destroy;
+ # XXX: add DESTROY and remove explicit calls
+ $bb_in->destroy;
+ $bb_out->destroy;
+ }
Apache::OK;
}