X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=blobdiff_plain;f=folly%2Fio%2Fasync%2FAsyncSSLSocket.cpp;h=e6513f8259db83e1e18890554294e75e459c5d3b;hp=bb2452e6cbcdce95b9ca1300bcf6053f200ae4c2;hb=4c7a736d6529f22451a0ec965e093e7e318695e3;hpb=d71b7361e718b3ee9ed720ae65f6223dbb9823a1 diff --git a/folly/io/async/AsyncSSLSocket.cpp b/folly/io/async/AsyncSSLSocket.cpp index bb2452e6..e6513f82 100644 --- a/folly/io/async/AsyncSSLSocket.cpp +++ b/folly/io/async/AsyncSSLSocket.cpp @@ -462,8 +462,8 @@ void AsyncSSLSocket::sslAccept( // Cache local and remote socket addresses to keep them available // after socket file descriptor is closed. - if (cacheAddrOnFailure_ && -1 != getFd()) { - cacheLocalPeerAddr(); + if (cacheAddrOnFailure_) { + cacheAddresses(); } handshakeStartTime_ = std::chrono::steady_clock::now(); @@ -665,19 +665,6 @@ void AsyncSSLSocket::invokeHandshakeCB() { } } -void AsyncSSLSocket::cacheLocalPeerAddr() { - SocketAddress address; - try { - getLocalAddress(&address); - getPeerAddress(&address); - } catch (const std::system_error& e) { - // The handle can be still valid while the connection is already closed. - if (e.code() != std::error_code(ENOTCONN, std::system_category())) { - throw; - } - } -} - void AsyncSSLSocket::connect( ConnectCallback* callback, const folly::SocketAddress& address, @@ -755,8 +742,8 @@ void AsyncSSLSocket::sslConn( // Cache local and remote socket addresses to keep them available // after socket file descriptor is closed. - if (cacheAddrOnFailure_ && -1 != getFd()) { - cacheLocalPeerAddr(); + if (cacheAddrOnFailure_) { + cacheAddresses(); } verifyPeer_ = verifyPeer;