]> Sergey Matveev's repositories - public-inbox.git/commitdiff
t/nntpd-tls: sometimes SSL_connect succeeds quickly
authorEric Wong <e@80x24.org>
Sun, 24 Nov 2019 00:22:26 +0000 (00:22 +0000)
committerEric Wong <e@80x24.org>
Sun, 24 Nov 2019 21:34:49 +0000 (21:34 +0000)
It seems caching can happen within OpenSSL or negotiation
can be delayed in some cases.  In any case, don't barf on
PublicInbox::TLS::epollbit() when connect_SSL succeeds
unexpectedly.

t/nntpd-tls.t

index 0b6afcefdff750ec189947a9697505922dbb404f..4e71e82d7f57bc34a372eb8dbc6722ce04f6b354 100644 (file)
@@ -120,8 +120,14 @@ for my $args (
        my $slow = tcp_connect($nntps, Blocking => 0);
        $slow = IO::Socket::SSL->start_SSL($slow, SSL_startHandshake => 0, %o);
        my $slow_done = $slow->connect_SSL;
-       diag('W: connect_SSL early OK, slow client test invalid') if $slow_done;
-       my @poll = (fileno($slow), PublicInbox::TLS::epollbit());
+       my @poll;
+       if ($slow_done) {
+               diag('W: connect_SSL early OK, slow client test invalid');
+               use PublicInbox::Syscall qw(EPOLLIN EPOLLOUT);
+               @poll = (fileno($slow), EPOLLIN | EPOLLOUT);
+       } else {
+               @poll = (fileno($slow), PublicInbox::TLS::epollbit());
+       }
        # we should call connect_SSL much later...
 
        # NNTPS