diff options
author | Eric Wong <e@yhbt.net> | 2020-06-16 22:31:20 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-06-21 00:42:32 +0000 |
commit | 8fd41797b24736dfdccfacc5acc473234a29758a (patch) | |
tree | 0a6f467777653ff98a5b933f0bd8bb748c809ff2 /lib/PublicInbox/DS.pm | |
parent | 74c897120af8ac4cac17d9f76d21c84f903e24be (diff) | |
download | public-inbox-8fd41797b24736dfdccfacc5acc473234a29758a.tar.gz |
daemon: use ->can to check for IO::Socket::SSL
Doing a ref($obj) string comparison ties us to IO::Socket::SSL (and OpenSSL) In the future, we may support GnuTLS or other TLS implementations. This was already done in the IMAP code.
Diffstat (limited to 'lib/PublicInbox/DS.pm')
-rw-r--r-- | lib/PublicInbox/DS.pm | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm index 01c8917e..b7753e1a 100644 --- a/lib/PublicInbox/DS.pm +++ b/lib/PublicInbox/DS.pm @@ -415,7 +415,7 @@ sub send_tmpio ($$) { } sub epbit ($$) { # (sock, default) - ref($_[0]) eq 'IO::Socket::SSL' ? PublicInbox::TLS::epollbit() : $_[1]; + $_[0]->can('stop_SSL') ? PublicInbox::TLS::epollbit() : $_[1]; } # returns 1 if done, 0 if incomplete @@ -569,7 +569,7 @@ sub msg_more ($$) { my $wbuf = $self->{wbuf}; if (MSG_MORE && (!defined($wbuf) || !scalar(@$wbuf)) && - ref($sock) ne 'IO::Socket::SSL') { + !$sock->can('stop_SSL')) { my $n = send($sock, $_[1], MSG_MORE); if (defined $n) { my $nlen = bytes::length($_[1]) - $n; @@ -619,7 +619,7 @@ sub shutdn_tls_step ($) { sub shutdn ($) { my ($self) = @_; my $sock = $self->{sock} or return; - if (ref($sock) eq 'IO::Socket::SSL') { + if ($sock->can('stop_SSL')) { shutdn_tls_step($self); } else { $self->close; |