• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 namespace net {
8 
MultiplexedSessionHandle(base::WeakPtr<MultiplexedSession> session)9 MultiplexedSessionHandle::MultiplexedSessionHandle(
10     base::WeakPtr<MultiplexedSession> session)
11     : session_(session) {
12   SaveSSLInfo();
13 }
14 
15 MultiplexedSessionHandle::~MultiplexedSessionHandle() = default;
16 
GetRemoteEndpoint(IPEndPoint * endpoint)17 int MultiplexedSessionHandle::GetRemoteEndpoint(IPEndPoint* endpoint) {
18   if (!session_)
19     return ERR_SOCKET_NOT_CONNECTED;
20 
21   return session_->GetRemoteEndpoint(endpoint);
22 }
23 
GetSSLInfo(SSLInfo * ssl_info) const24 bool MultiplexedSessionHandle::GetSSLInfo(SSLInfo* ssl_info) const {
25   if (!has_ssl_info_)
26     return false;
27 
28   *ssl_info = ssl_info_;
29   return true;
30 }
31 
SaveSSLInfo()32 void MultiplexedSessionHandle::SaveSSLInfo() {
33   has_ssl_info_ = session_->GetSSLInfo(&ssl_info_);
34 }
35 
GetAcceptChViaAlps(const url::SchemeHostPort & scheme_host_port) const36 base::StringPiece MultiplexedSessionHandle::GetAcceptChViaAlps(
37     const url::SchemeHostPort& scheme_host_port) const {
38   return session_ ? session_->GetAcceptChViaAlps(scheme_host_port)
39                   : base::StringPiece();
40 }
41 
42 }  // namespace net
43