| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/spdy/spdy_session.h" | 5 #include "net/spdy/spdy_session.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 connection_.reset(connection); | 250 connection_.reset(connection); |
| 251 is_secure_ = true; // |connection| contains an SSLClientSocket. | 251 is_secure_ = true; // |connection| contains an SSLClientSocket. |
| 252 | 252 |
| 253 // This is a newly initialized session that no client should have a handle to | 253 // This is a newly initialized session that no client should have a handle to |
| 254 // yet, so there's no need to start writing data as in OnTCPConnect(), but we | 254 // yet, so there's no need to start writing data as in OnTCPConnect(), but we |
| 255 // should start reading data. | 255 // should start reading data. |
| 256 ReadSocket(); | 256 ReadSocket(); |
| 257 } | 257 } |
| 258 | 258 |
| 259 net::Error SpdySession::Connect(const std::string& group_name, | 259 net::Error SpdySession::Connect(const std::string& group_name, |
| 260 const HostResolver::RequestInfo& host, | 260 const TCPSocketParams& destination, |
| 261 RequestPriority priority, | 261 RequestPriority priority, |
| 262 LoadLog* load_log) { | 262 LoadLog* load_log) { |
| 263 DCHECK(priority >= SPDY_PRIORITY_HIGHEST && priority <= SPDY_PRIORITY_LOWEST); | 263 DCHECK(priority >= SPDY_PRIORITY_HIGHEST && priority <= SPDY_PRIORITY_LOWEST); |
| 264 | 264 |
| 265 // If the connect process is started, let the caller continue. | 265 // If the connect process is started, let the caller continue. |
| 266 if (state_ > IDLE) | 266 if (state_ > IDLE) |
| 267 return net::OK; | 267 return net::OK; |
| 268 | 268 |
| 269 state_ = CONNECTING; | 269 state_ = CONNECTING; |
| 270 | 270 |
| 271 static StatsCounter spdy_sessions("spdy.sessions"); | 271 static StatsCounter spdy_sessions("spdy.sessions"); |
| 272 spdy_sessions.Increment(); | 272 spdy_sessions.Increment(); |
| 273 | 273 |
| 274 int rv = connection_->Init(group_name, host, priority, &connect_callback_, | 274 int rv = connection_->Init(group_name, destination, priority, |
| 275 session_->tcp_socket_pool(), load_log); | 275 &connect_callback_, session_->tcp_socket_pool(), |
| 276 load_log); |
| 276 DCHECK(rv <= 0); | 277 DCHECK(rv <= 0); |
| 277 | 278 |
| 278 // If the connect is pending, we still return ok. The APIs enqueue | 279 // If the connect is pending, we still return ok. The APIs enqueue |
| 279 // work until after the connect completes asynchronously later. | 280 // work until after the connect completes asynchronously later. |
| 280 if (rv == net::ERR_IO_PENDING) | 281 if (rv == net::ERR_IO_PENDING) |
| 281 return net::OK; | 282 return net::OK; |
| 282 return static_cast<net::Error>(rv); | 283 return static_cast<net::Error>(rv); |
| 283 } | 284 } |
| 284 | 285 |
| 285 scoped_refptr<SpdyStream> SpdySession::GetOrCreateStream( | 286 scoped_refptr<SpdyStream> SpdySession::GetOrCreateStream( |
| (...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1036 LOG(ERROR) << "Spdy stream closed: " << frame->status(); | 1037 LOG(ERROR) << "Spdy stream closed: " << frame->status(); |
| 1037 // TODO(mbelshe): Map from Spdy-protocol errors to something sensical. | 1038 // TODO(mbelshe): Map from Spdy-protocol errors to something sensical. |
| 1038 // For now, it doesn't matter much - it is a protocol error. | 1039 // For now, it doesn't matter much - it is a protocol error. |
| 1039 stream->OnClose(ERR_FAILED); | 1040 stream->OnClose(ERR_FAILED); |
| 1040 } | 1041 } |
| 1041 | 1042 |
| 1042 DeactivateStream(stream_id); | 1043 DeactivateStream(stream_id); |
| 1043 } | 1044 } |
| 1044 | 1045 |
| 1045 } // namespace net | 1046 } // namespace net |
| OLD | NEW |