Send data to the remote server in large chunks.
Reduces a lot the sending time when running on slow CPUs. git-svn-id: https://svn.perl.org/qpsmtpd/trunk@922 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
parent
4c93c85f55
commit
b03dddcb48
@ -261,10 +261,19 @@ sub cmd_data {
|
||||
# $self->{state} = ST_DATA;
|
||||
$self->datasend($self->{tran}->header->as_string);
|
||||
$self->{tran}->body_resetpos;
|
||||
my $write_buf = '';
|
||||
while (my $line = $self->{tran}->body_getline) {
|
||||
$self->log(LOGDEBUG, ">> $line");
|
||||
$line =~ s/\r?\n/\r\n/;
|
||||
$self->datasend($line);
|
||||
$write_buf .= $line;
|
||||
if (length($write_buf) >= 131072) { # 128KB, arbitrary value
|
||||
$self->log(LOGDEBUG, ">> $write_buf");
|
||||
$self->datasend($write_buf);
|
||||
$write_buf = '';
|
||||
}
|
||||
}
|
||||
if (length($write_buf)) {
|
||||
$self->log(LOGDEBUG, ">> $write_buf");
|
||||
$self->datasend($write_buf);
|
||||
}
|
||||
$self->write(".\r\n");
|
||||
$self->{command} = "DATAEND";
|
||||
|
Loading…
Reference in New Issue
Block a user