From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id E5C5E1F4B9 for ; Sun, 24 Nov 2019 00:22:39 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 06/17] t/nntpd-tls: sometimes SSL_connect succeeds quickly Date: Sun, 24 Nov 2019 00:22:26 +0000 Message-Id: <20191124002237.15713-7-e@80x24.org> In-Reply-To: <20191124002237.15713-1-e@80x24.org> References: <20191124002237.15713-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/t/nntpd-tls.t b/t/nntpd-tls.t index 0b6afcef..4e71e82d 100644 --- a/t/nntpd-tls.t +++ b/t/nntpd-tls.t @@ -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