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

Unified Diff: net/socket_stream/socket_stream.cc

Issue 3020068: WebSocket over SPDY. (Closed)
Patch Set: fix unittests Created 10 years 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
« no previous file with comments | « net/socket_stream/socket_stream.h ('k') | net/spdy/spdy_framer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket_stream/socket_stream.cc
diff --git a/net/socket_stream/socket_stream.cc b/net/socket_stream/socket_stream.cc
index 4075e02da67d39df6715d7069b32b7200def9f6a..41f62a962ad9acfbd6aa4861cbf9f7f86d0b5440 100644
--- a/net/socket_stream/socket_stream.cc
+++ b/net/socket_stream/socket_stream.cc
@@ -31,6 +31,8 @@
#include "net/socket/ssl_client_socket.h"
#include "net/socket/tcp_client_socket.h"
#include "net/socket_stream/socket_stream_metrics.h"
+#include "net/spdy/spdy_session.h"
+#include "net/spdy/spdy_stream.h"
#include "net/url_request/url_request.h"
static const int kMaxPendingSendAllowed = 32768; // 32 kilobytes.
@@ -438,6 +440,10 @@ void SocketStream::DoLoop(int result) {
DCHECK_LE(result, OK);
Finish(result);
return;
+ case STATE_SPDY:
+ DCHECK_EQ(result, OK);
+ result = DoSpdy();
+ break;
default:
NOTREACHED() << "bad state " << state;
Finish(result);
@@ -463,6 +469,11 @@ int SocketStream::DoResolveProxy() {
return ERR_INVALID_ARGUMENT;
}
+ // |endpoint_| indicates the final destination endpoint.
+ endpoint_ = HostPortPair(url_.HostNoBrackets(), url_.EffectiveIntPort());
+
+ // TODO(ukai): check alternate protocols?
+
return proxy_service()->ResolveProxy(
proxy_url_, &proxy_info_, &io_callback_, &pac_request_, net_log_);
}
@@ -541,6 +552,25 @@ int SocketStream::DoResolveHostComplete(int result) {
return result;
}
+const HostPortPair& SocketStream::GetHostPortPair() const {
+ return endpoint_;
+}
+
+const ProxyServer& SocketStream::proxy_server() const {
+ return proxy_info_.proxy_server();
+}
+
+void SocketStream::SwitchToSpdy() {
+ DCHECK_EQ(STATE_TCP_CONNECT, next_state_);
+ next_state_ = STATE_SPDY;
+}
+
+int SocketStream::DoSpdy() {
+ metrics_->OnConnected();
+ net_log_.EndEvent(NetLog::TYPE_SOCKET_STREAM_CONNECT, NULL);
+ return ERR_IO_PENDING; // Finish DoLoop.
+}
+
int SocketStream::DoTcpConnect(int result) {
if (result != OK) {
next_state_ = STATE_CLOSE;
@@ -843,6 +873,8 @@ int SocketStream::DoSSLConnectComplete(int result) {
}
}
+ // TODO(ukai): upgrade to spdy session if possible.
+
if (result == OK)
result = DidEstablishConnection();
else
« no previous file with comments | « net/socket_stream/socket_stream.h ('k') | net/spdy/spdy_framer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698