summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfukachan <fukachan>2001-10-10 09:46:21 +0000
committerfukachan <fukachan>2001-10-10 09:46:21 +0000
commit6f3e0dd06672c507fd53ae910d4ef2aeb66490e7 (patch)
tree60c3575123c99f74906f082599c6af2308cfea1f
parente1faf1fce0fa2fddab59c6fdeeb27ec0aad8e065 (diff)
downloadfml8-6f3e0dd06672c507fd53ae910d4ef2aeb66490e7.tar.gz
fml8-6f3e0dd06672c507fd53ae910d4ef2aeb66490e7.tar.bz2
fml8-6f3e0dd06672c507fd53ae910d4ef2aeb66490e7.zip
oops, old IO::Socket has no connected() method.
modified to use our own socket_is_connected() method or remove connected() check.
-rw-r--r--fml/lib/Mail/Delivery/Net/INET6.pm6
-rw-r--r--fml/lib/Mail/Delivery/SMTP.pm31
2 files changed, 31 insertions, 6 deletions
diff --git a/fml/lib/Mail/Delivery/Net/INET6.pm b/fml/lib/Mail/Delivery/Net/INET6.pm
index b3663b8c..a311ef05 100644
--- a/fml/lib/Mail/Delivery/Net/INET6.pm
+++ b/fml/lib/Mail/Delivery/Net/INET6.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: INET6.pm,v 1.4 2001/05/31 11:02:34 fukachan Exp $
+# $FML: INET6.pm,v 1.5 2001/10/10 08:51:08 fukachan Exp $
#
package Mail::Delivery::Net::INET6;
@@ -133,7 +133,9 @@ sub connect6
}
# check socket is under connected state.
- if (($family != -1) && defined($fh) && ($fh->connected)) {
+ # XXX sub $socket->connected { getpeername($self);}
+ # XXX IO::Socket of old perl have no such method.
+ if (($family != -1) && defined($fh)) {
if ($family == AF_INET6) {
$self->{_socket} = $fh;
Log("connected to $host:$port by IPv6");
diff --git a/fml/lib/Mail/Delivery/SMTP.pm b/fml/lib/Mail/Delivery/SMTP.pm
index 5b32d6b8..0e833b04 100644
--- a/fml/lib/Mail/Delivery/SMTP.pm
+++ b/fml/lib/Mail/Delivery/SMTP.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: SMTP.pm,v 1.7 2001/07/08 13:37:22 fukachan Exp $
+# $FML: SMTP.pm,v 1.8 2001/10/10 08:50:04 fukachan Exp $
#
@@ -187,7 +187,8 @@ sub _read_reply
alarm( $self->{_default_io_timeout} );
my $buf = '';
- croak("socket is not connected") unless $socket->connected;
+ croak("socket is not connected") unless
+ $self->socket_is_connected($socket);
SMTP_REPLY:
while (1) {
@@ -278,6 +279,27 @@ sub _connect
}
}
+=head2 C<socket_is_connected($socket)>
+
+$socket has peer or not by C<getpeername()>.
+
+ XXX sub $socket->connected { getpeername($self);}
+ XXX IO::Socket of old perl have no such method.
+
+=cut
+
+
+sub socket_is_connected
+{
+ my ($self, $socket) = @_;
+
+ if (defined $socket) {
+ return( getpeername($socket) );
+ }
+
+ return 0;
+}
+
=head2 C<close()>
@@ -511,8 +533,9 @@ sub _deliver
# 0. create BSD SOCKET as the communication terminal
# IF_ERROR_FOUND: do nothing and return as soon as possible
- my $socket = $self->_connect($args);
- unless (defined($socket) && $socket->connected) {
+ my $socket = $self->_connect($args);
+ my $is_connected = $self->socket_is_connected($socket);
+ unless (defined($socket) && $is_connected) {
Log("cannot connected");
return undef;
}