Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fix POE::Wheel::Run not triggering StdinEvent #14

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
Contributor

nkukard commented Sep 1, 2013

Driver/SysRw.pm contains a return of TOTAL_OCTETS_LEFT:

sub flush {
. . .
$self->[TOTAL_OCTETS_LEFT];
}

This is the number of octets still pending to be sent.

But... Wheel/Run.pm contains the definer for the flusher..

sub _define_stdin_flusher {
. . .
$$stdin_octets = $driver->flush($handle);
. . .
# All chunks written; fire off a "flushed" event.
unless ($$stdin_octets) {
$k->select_pause_write($handle);
$$stdin_event && $k->call($me, $$stdin_event, $unique_id);
. . .

It appears that $$stdin_octets is being used incorrectly in this context
as the StdinEvent would be triggered if there still is data pending to be
flushed.

The attached fix changes this to "if (!$$stdin_octets) {" which evaluates
to true when there is no data left to be flushed.

Fix POE::Wheel::Run not triggering StdinEvent
Driver/SysRw.pm contains a return of TOTAL_OCTETS_LEFT:
> sub flush {
> . . .
>   $self->[TOTAL_OCTETS_LEFT];
> }

This is the number of octets still pending to be sent.

But... Wheel/Run.pm contains the definer for the flusher..
> sub _define_stdin_flusher {
> . . .
>                               $$stdin_octets = $driver->flush($handle);
> . . .
>        # All chunks written; fire off a "flushed" event.
>        unless ($$stdin_octets) {
>          $k->select_pause_write($handle);
>          $$stdin_event && $k->call($me, $$stdin_event, $unique_id);
> . . .

It appears that $$stdin_octets is being used incorrectly in this context
as the StdinEvent would be triggered if there still is data pending to be
flushed.

The attached fix changes this to "if (!$$stdin_octets) {" which evaluates
to true when there is no data left to be flushed.

@nkukard nkukard closed this Sep 1, 2013

Owner

rcaputo commented Sep 1, 2013

Thanks anyway. It's good to know people are reviewing the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment