1 // Copyright 2016 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "net/spdy/multiplexed_session.h" 6 7 #include <string_view> 8 9 namespace net { 10 MultiplexedSessionHandle(base::WeakPtr<MultiplexedSession> session)11MultiplexedSessionHandle::MultiplexedSessionHandle( 12 base::WeakPtr<MultiplexedSession> session) 13 : session_(session) { 14 SaveSSLInfo(); 15 } 16 17 MultiplexedSessionHandle::~MultiplexedSessionHandle() = default; 18 GetRemoteEndpoint(IPEndPoint * endpoint)19int MultiplexedSessionHandle::GetRemoteEndpoint(IPEndPoint* endpoint) { 20 if (!session_) 21 return ERR_SOCKET_NOT_CONNECTED; 22 23 return session_->GetRemoteEndpoint(endpoint); 24 } 25 GetSSLInfo(SSLInfo * ssl_info) const26bool MultiplexedSessionHandle::GetSSLInfo(SSLInfo* ssl_info) const { 27 if (!has_ssl_info_) 28 return false; 29 30 *ssl_info = ssl_info_; 31 return true; 32 } 33 SaveSSLInfo()34void MultiplexedSessionHandle::SaveSSLInfo() { 35 has_ssl_info_ = session_->GetSSLInfo(&ssl_info_); 36 } 37 GetAcceptChViaAlps(const url::SchemeHostPort & scheme_host_port) const38std::string_view MultiplexedSessionHandle::GetAcceptChViaAlps( 39 const url::SchemeHostPort& scheme_host_port) const { 40 return session_ ? session_->GetAcceptChViaAlps(scheme_host_port) 41 : std::string_view(); 42 } 43 44 } // namespace net 45