Fix for when pipelining occurs we need to shift the pre-read data back onto
the socket and let the socket loop come back to this socket's data later. git-svn-id: https://svn.perl.org/qpsmtpd/branches/high_perf@451 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
parent
a268ec079a
commit
1f98f22376
@ -90,7 +90,7 @@ sub process_read_buf {
|
|||||||
my Danga::Client $self = shift;
|
my Danga::Client $self = shift;
|
||||||
my $bref = shift;
|
my $bref = shift;
|
||||||
$self->{line} .= $$bref;
|
$self->{line} .= $$bref;
|
||||||
return if $self->{can_read_mode};
|
return if ! $self->readable();
|
||||||
return if $::LineMode;
|
return if $::LineMode;
|
||||||
|
|
||||||
while ($self->{line} =~ s/^(.*?\n)//) {
|
while ($self->{line} =~ s/^(.*?\n)//) {
|
||||||
@ -100,7 +100,18 @@ sub process_read_buf {
|
|||||||
if ($::DEBUG > 1 and $resp) { print "$$:".($self+0)."S: $_\n" for split(/\n/, $resp) }
|
if ($::DEBUG > 1 and $resp) { print "$$:".($self+0)."S: $_\n" for split(/\n/, $resp) }
|
||||||
$self->write($resp) if $resp;
|
$self->write($resp) if $resp;
|
||||||
$self->watch_read(0) if $self->{disable_read};
|
$self->watch_read(0) if $self->{disable_read};
|
||||||
|
last if ! $self->readable();
|
||||||
}
|
}
|
||||||
|
if($self->have_line) {
|
||||||
|
$self->shift_back_read($self->{line});
|
||||||
|
$self->{line} = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub readable {
|
||||||
|
my Danga::Client $self = shift;
|
||||||
|
return 0 if $self->{disable_read} > 0;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub disable_read {
|
sub disable_read {
|
||||||
|
@ -636,6 +636,17 @@ sub push_back_read {
|
|||||||
$PushBackSet{$self->{fd}} = $self;
|
$PushBackSet{$self->{fd}} = $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
### METHOD: shift_back_read( $buf )
|
||||||
|
### Shift back I<buf> (a scalar or scalarref) into the read stream
|
||||||
|
### Use this instead of push_back_read() when you need to unread
|
||||||
|
### something you just read.
|
||||||
|
sub shift_back_read {
|
||||||
|
my Danga::Socket $self = shift;
|
||||||
|
my $buf = shift;
|
||||||
|
unshift @{$self->{read_push_back}}, ref $buf ? $buf : \$buf;
|
||||||
|
$PushBackSet{$self->{fd}} = $self;
|
||||||
|
}
|
||||||
|
|
||||||
### METHOD: read( $bytecount )
|
### METHOD: read( $bytecount )
|
||||||
### Read at most I<bytecount> bytes from the underlying handle; returns scalar
|
### Read at most I<bytecount> bytes from the underlying handle; returns scalar
|
||||||
### ref on read, or undef on connection closed.
|
### ref on read, or undef on connection closed.
|
||||||
|
Loading…
Reference in New Issue
Block a user