You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2020/04/24 22:09:49 UTC

[mesos] 04/06: Fixed a bug where the openssl socket can block forever.

This is an automated email from the ASF dual-hosted git repository.

bmahler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 44bb7777450e3b585cb1e821a2fd6915528b1cac
Author: Benjamin Mahler <bm...@apache.org>
AuthorDate: Mon Apr 20 14:28:33 2020 -0400

    Fixed a bug where the openssl socket can block forever.
    
    Using the zero byte read trick against io::read is problematic
    since io::read aims to provide consistent behavior across POSIX
    and Windows by returning immediately.
    
    Now that io::poll for reads is implemented, we can fix this by
    removing the Windows specialization and just using io::poll.
    
    Review: https://reviews.apache.org/r/72406
---
 3rdparty/libprocess/src/ssl/openssl_socket.cpp | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/3rdparty/libprocess/src/ssl/openssl_socket.cpp b/3rdparty/libprocess/src/ssl/openssl_socket.cpp
index 3f4dab6..f03a34f 100644
--- a/3rdparty/libprocess/src/ssl/openssl_socket.cpp
+++ b/3rdparty/libprocess/src/ssl/openssl_socket.cpp
@@ -577,14 +577,7 @@ Future<std::shared_ptr<SocketImpl>> OpenSSLSocketImpl::accept()
           // socket to become readable. We will then MSG_PEEK it to test
           // whether we want to dispatch as SSL or non-SSL.
           if (openssl::flags().support_downgrade) {
-#ifdef __WINDOWS__
-            // Since there is no `io::poll` on Windows, we instead make
-            // a 0-byte read, which will only return once there is something
-            // to read.
-            return io::read(socket->get(), nullptr, 0)
-#else
             return io::poll(socket->get(), process::io::READ)
-#endif // __WINDOWS__
               .then([weak_self, socket]() -> Future<ControlFlow<Nothing>> {
                 std::shared_ptr<OpenSSLSocketImpl> self(weak_self.lock());