- set a sane ALRM handler

- pass more information to the Connection


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@291 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Robert Spier 2004-08-29 07:57:07 +00:00
parent e1785b1923
commit acbb51a555

View File

@ -151,7 +151,11 @@ while (1) {
close($server);
$SIG{$_} = 'DEFAULT' for keys %SIG;
$SIG{ALRM} = sub {
print $client "421 Connection Timed Out\n";
::log(LOGINFO, "Connection Timed Out");
exit; };
my $localsockaddr = getsockname($client);
my ($lport, $laddr) = sockaddr_in($localsockaddr);
$ENV{TCPLOCALIP} = inet_ntoa($laddr);
@ -169,7 +173,13 @@ while (1) {
POSIX::dup2(fileno($client), 1);
my $qpsmtpd = Qpsmtpd::TcpServer->new();
$qpsmtpd->start_connection();
$qpsmtpd->start_connection
(
local_ip => $ENV{TCPLOCALIP},
local_port => $lport,
remote_ip => $ENV{TCPREMOTEIP},
remote_port => $port,
);
$qpsmtpd->run();
exit; # child leaves