Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(484)

Unified Diff: net/quic/quic_client_session.cc

Issue 11364068: Add a QuicHttpStream class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move GetPeerAddress from QuicReliableClientStream to ReliableQuicStream Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/quic/quic_client_session.cc
diff --git a/net/quic/quic_client_session.cc b/net/quic/quic_client_session.cc
index cf101c6066bf30615362e10fb3439277cda36f96..fd3c8273f2aaccbb2ebb6464e2fe7dac59ab3b83 100644
--- a/net/quic/quic_client_session.cc
+++ b/net/quic/quic_client_session.cc
@@ -4,6 +4,8 @@
#include "net/quic/quic_client_session.h"
+#include "net/base/net_errors.h"
+
namespace net {
QuicClientSession::QuicClientSession(QuicConnection* connection)
@@ -12,6 +14,7 @@ QuicClientSession::QuicClientSession(QuicConnection* connection)
}
QuicClientSession::~QuicClientSession() {
+ STLDeleteValues(&streams_);
}
QuicReliableClientStream* QuicClientSession::CreateOutgoingReliableStream() {
@@ -26,6 +29,7 @@ QuicReliableClientStream* QuicClientSession::CreateOutgoingReliableStream() {
}
QuicReliableClientStream* stream =
new QuicReliableClientStream(GetNextStreamId(), this);
+ streams_[stream->id()] = stream;
ActivateStream(stream);
return stream;
@@ -35,10 +39,17 @@ QuicCryptoClientStream* QuicClientSession::GetCryptoStream() {
return &crypto_stream_;
};
-void QuicClientSession::CryptoConnect() {
+int QuicClientSession::CryptoConnect(const CompletionCallback& callback) {
CryptoHandshakeMessage message;
message.tag = kCHLO;
crypto_stream_.SendHandshakeMessage(message);
+
+ if (IsCryptoHandshakeComplete()) {
+ return OK;
+ }
+
+ callback_ = callback;
+ return ERR_IO_PENDING;
}
ReliableQuicStream* QuicClientSession::CreateIncomingReliableStream(
@@ -47,4 +58,22 @@ ReliableQuicStream* QuicClientSession::CreateIncomingReliableStream(
return NULL;
}
+void QuicClientSession::CloseStream(QuicStreamId stream_id) {
+ QuicSession::CloseStream(stream_id);
+
+ StreamMap::iterator it = streams_.find(stream_id);
+ DCHECK(it != streams_.end());
+ if (it != streams_.end()) {
+ ReliableQuicStream* stream = it->second;
+ streams_.erase(it);
+ delete stream;
+ }
+}
+
+void QuicClientSession::OnCryptoHandshakeComplete(QuicErrorCode error) {
+ if (!callback_.is_null()) {
+ callback_.Run(error == QUIC_NO_ERROR ? OK : ERR_UNEXPECTED);
+ }
+}
+
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698