Skip Menu |

This queue is for tickets about the POE-Loop-Glib CPAN distribution.

Report information
The Basics
Id: 53302
Status: resolved
Priority: 0/
Queue: POE-Loop-Glib

People
Owner: Nobody in particular
Requestors: RCAPUTO [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: (no value)
Fixed in: (no value)



Subject: Filehandle watchers shut down after a single event?
The following server only accepts one connection. The select_read() for the listening socket fires only once. POE::Loop::Glib's filehandle callbacks return 0, which prevents them from firing a second time. Changing the callbacks to return 1 fixes this server. use strict; use warnings; sub POE::Kernel::ASSERT_DEFAULT () { 1 } sub POE::Kernel::TRACE_FILES () { 1 } use Glib; use POE qw/Loop::Glib/; use POE::Component::Server::TCP; POE::Component::Server::TCP->new( Alias => "sum_server", Address => "localhost", Port => 12345, Started => sub { print("Started\n"); }, ClientConnected => sub { print("Client Connected\n"); }, ClientInput => sub { my ($heap, $data) = @_[HEAP, ARG0]; print("Received input: $data\n"); $heap->{client}->put("Poing!"); $_[KERNEL]->yield('shutdown'); }, ClientDisconnected => sub { my $kernel = $_[KERNEL]; print("Client disconnected\n"); }, ); print "Using loop: " . $poe_kernel->poe_kernel_loop() . "\n"; $poe_kernel->run();
Hello, This attached patch against POE-Loop-Glib v0.037 resolves this issue. However, in the POE::Test::Loops svn trunk I have added 2 new tests, and one of them fails with a wrong flush count... I've ran the same test against polo-io_poll, polo-select, and polo-tk and they all pass so it probably is not my testcase :( apoc@blackhole:~$ diff -urbd POE-Loop-Glib-0.037/ POE-Loop-Glib-0.037-myver/ diff -urbd POE-Loop-Glib-0.037/lib/POE/Loop/Glib.pm POE-Loop-Glib-0.037-myver/lib/POE/Loop/Glib.pm --- POE-Loop-Glib-0.037/lib/POE/Loop/Glib.pm 2008-07-06 11:40:54.000000000 -0700 +++ POE-Loop-Glib-0.037-myver/lib/POE/Loop/Glib.pm 2010-03-10 19:15:57.000000000 -0700 @@ -203,8 +203,7 @@ $self->_data_handle_enqueue_ready(MODE_RD, $fileno); $self->_test_if_kernel_is_idle(); - # Return false to stop... probably not with this one. - return 0; + return 1; } sub _loop_select_write_callback { @@ -218,8 +217,7 @@ $self->_data_handle_enqueue_ready(MODE_WR, $fileno); $self->_test_if_kernel_is_idle(); - # Return false to stop... probably not with this one. - return 0; + return 1; } @@ -317,3 +315,13 @@ See the file LICENCE for details. =cut + +=for poe_tests + +sub skip_tests { + my $test_name = shift; + return "Glib tests require the Glib module" if do { eval "use Glib"; $@ }; + return; +} + +=cut apoc@blackhole:~$ t/glib/z_rt53302_fh_watchers.t ......... 1/7 # Failed test 'Server flushed 5 lines of data' # at /usr/local/share/perl/5.10.0/POE/Test/Loops/z_rt53302_fh_watchers.pm line 106. # got: '2' # expected: '5' # Looks like you failed 1 test of 7. t/glib/z_rt53302_fh_watchers.t ......... Dubious, test returned 1 (wstat 256, 0x100) Failed 1/7 subtests t/glib/z_rt53302_fh_watchers_slow.t .... ok -- ~Apocalypse
Hi, PoLo-GLib v0.038 on CPAN includes this patch. Thanks! -- ~Apocalypse