On Sun, 5 Dec 2004, Stas Bekman wrote: > 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): [ ... ] Just to confirm (the included patch didn't apply cleanly for me), I used the following: ========================================================== Index: t/protocol/TestProtocol/echo_bbs2.pm =================================================================== --- t/protocol/TestProtocol/echo_bbs2.pm (revision 110089) +++ t/protocol/TestProtocol/echo_bbs2.pm (working copy) @@ -4,11 +4,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,10 +23,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); @@ -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; } ================================================================= With this, subtests 1 and 2 passed, but it failed on subtest 3 (it expected "WORLD", but received nothing, and there was an access violation in libaprutil.lib). The troubling call was in $bb_in->cleanup (or $bb_out->cleanup, if that was moved before $bb_in->cleanup). However, I tried changing WrapXS/APR/Brigade/Brigade.xs to read (in the declaration of apr_brigade_cleanup) apr_status_t apr_brigade_cleanup(data) APR::Brigade data With this, the above patched protocol/echo_bbs2 tests all pass. Given the declaration of apr_brigade_cleanup(void *data) in $APACHE2/include/apr_buckets.h, this change seems wrong - perhaps it indicates something's wrong in Win32? -- best regards, randy --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
