forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquic_client_session.cc
50 lines (40 loc) · 1.37 KB
/
quic_client_session.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "net/quic/quic_client_session.h"
namespace net {
QuicClientSession::QuicClientSession(QuicConnection* connection)
: QuicSession(connection, false),
crypto_stream_(this) {
}
QuicClientSession::~QuicClientSession() {
}
QuicReliableClientStream* QuicClientSession::CreateOutgoingReliableStream() {
if (!crypto_stream_.handshake_complete()) {
DLOG(INFO) << "Crypto handshake not complete, no outgoing stream created.";
return NULL;
}
if (GetNumOpenStreams() >= get_max_open_streams()) {
DLOG(INFO) << "Failed to create a new outgoing stream. "
<< "Already " << GetNumOpenStreams() << " open.";
return NULL;
}
QuicReliableClientStream* stream =
new QuicReliableClientStream(GetNextStreamId(), this);
ActivateStream(stream);
return stream;
}
QuicCryptoClientStream* QuicClientSession::GetCryptoStream() {
return &crypto_stream_;
};
void QuicClientSession::CryptoConnect() {
CryptoHandshakeMessage message;
message.tag = kCHLO;
crypto_stream_.SendHandshakeMessage(message);
}
ReliableQuicStream* QuicClientSession::CreateIncomingReliableStream(
QuicStreamId id) {
DLOG(ERROR) << "Server push not supported";
return NULL;
}
} // namespace net