Skip to content

Commit

Permalink
Wake and sleep events with "push back" data
Browse files Browse the repository at this point in the history
This module's watch_read function, which is monkeypatched into
Danga::Socket, sets up an AnyEvent io event watcher on reads; but in
the case where synthetic reads ("push_back_read") are in effect, this
event will never fire.  This case can be detected, and the bit flipped
as in a previous change.  It also has a converse, which is to clear it
in the same situations.
  • Loading branch information
Sam Vilain committed Jun 14, 2012
1 parent 8dc45db commit 5f0919b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/Danga/Socket/AnyEvent.pm
Original file line number Diff line number Diff line change
Expand Up @@ -962,9 +962,15 @@ sub watch_read {
$self->event_read() unless $self->{closed};
}),
);
if ( $PushBackSet{$fd} ) {
$self->{event_watch} |= POLLIN;
}
}
else {
$watchers->[0] = undef;
if ( $PushBackSet{$fd} ) {
$self->{event_watch} &= ~POLLIN;
}
}
}

Expand Down

0 comments on commit 5f0919b

Please sign in to comment.