Author: radu
Date: Mon Jun 2 09:48:20 2008
New Revision: 922
Modified:
trunk/plugins/async/queue/smtp-forward
Log:
Send data to the remote server in large chunks. Reduces a lot the sending
time when running on slow CPUs.
Modified: trunk/plugins/async/queue/smtp-forward
==============================================================================
--- trunk/plugins/async/queue/smtp-forward (original)
+++ trunk/plugins/async/queue/smtp-forward Mon Jun 2 09:48:20 2008
@@ -261,10 +261,19 @@
# $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";