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

Side by Side Diff: net/spdy/spdy_session.cc

Issue 22159003: DO NOT COMMIT: More hacks to get HTTP/2 working Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update for draft 06 Created 7 years, 2 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/spdy/spdy_session.h ('k') | net/spdy/spdy_stream.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 SSLClientSocket* ssl_socket = GetSSLClientSocket(); 742 SSLClientSocket* ssl_socket = GetSSLClientSocket();
743 if (ssl_socket->GetNegotiatedProtocol() < kProtoSPDY3) 743 if (ssl_socket->GetNegotiatedProtocol() < kProtoSPDY3)
744 return false; 744 return false;
745 return ssl_socket->WasChannelIDSent(); 745 return ssl_socket->WasChannelIDSent();
746 } 746 }
747 747
748 void SpdySession::AddPooledAlias(const SpdySessionKey& alias_key) { 748 void SpdySession::AddPooledAlias(const SpdySessionKey& alias_key) {
749 pooled_aliases_.insert(alias_key); 749 pooled_aliases_.insert(alias_key);
750 } 750 }
751 751
752 int SpdySession::GetProtocolVersion() const { 752 SpdyMajorVersion SpdySession::GetProtocolVersion() const {
753 DCHECK(buffered_spdy_framer_.get()); 753 DCHECK(buffered_spdy_framer_.get());
754 return buffered_spdy_framer_->protocol_version(); 754 return buffered_spdy_framer_->protocol_version();
755 } 755 }
756 756
757 base::WeakPtr<SpdySession> SpdySession::GetWeakPtr() { 757 base::WeakPtr<SpdySession> SpdySession::GetWeakPtr() {
758 return weak_factory_.GetWeakPtr(); 758 return weak_factory_.GetWeakPtr();
759 } 759 }
760 760
761 bool SpdySession::CloseOneIdleConnection() { 761 bool SpdySession::CloseOneIdleConnection() {
762 CHECK(!in_io_loop_); 762 CHECK(!in_io_loop_);
(...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after
2231 2231
2232 std::string description; 2232 std::string description;
2233 net_log().AddEvent( 2233 net_log().AddEvent(
2234 NetLog::TYPE_SPDY_SESSION_RST_STREAM, 2234 NetLog::TYPE_SPDY_SESSION_RST_STREAM,
2235 base::Bind(&NetLogSpdyRstCallback, 2235 base::Bind(&NetLogSpdyRstCallback,
2236 stream_id, status, &description)); 2236 stream_id, status, &description));
2237 2237
2238 ActiveStreamMap::iterator it = active_streams_.find(stream_id); 2238 ActiveStreamMap::iterator it = active_streams_.find(stream_id);
2239 if (it == active_streams_.end()) { 2239 if (it == active_streams_.end()) {
2240 // NOTE: it may just be that the stream was cancelled. 2240 // NOTE: it may just be that the stream was cancelled.
2241 LOG(WARNING) << "Received RST for invalid stream" << stream_id; 2241 LOG(WARNING) << "Received RST for invalid stream " << stream_id;
2242 return; 2242 return;
2243 } 2243 }
2244 2244
2245 CHECK_EQ(it->second.stream->stream_id(), stream_id); 2245 CHECK_EQ(it->second.stream->stream_id(), stream_id);
2246 2246
2247 if (status == 0) { 2247 if (status == 0) {
2248 it->second.stream->OnDataReceived(scoped_ptr<SpdyBuffer>()); 2248 it->second.stream->OnDataReceived(scoped_ptr<SpdyBuffer>());
2249 } else if (status == RST_STREAM_REFUSED_STREAM) { 2249 } else if (status == RST_STREAM_REFUSED_STREAM) {
2250 CloseActiveStreamIterator(it, ERR_SPDY_SERVER_REFUSED_STREAM); 2250 CloseActiveStreamIterator(it, ERR_SPDY_SERVER_REFUSED_STREAM);
2251 } else { 2251 } else {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2293 2293
2294 if (availability_state_ == STATE_CLOSED) 2294 if (availability_state_ == STATE_CLOSED)
2295 return; 2295 return;
2296 2296
2297 net_log_.AddEvent( 2297 net_log_.AddEvent(
2298 NetLog::TYPE_SPDY_SESSION_PING, 2298 NetLog::TYPE_SPDY_SESSION_PING,
2299 base::Bind(&NetLogSpdyPingCallback, unique_id, "received")); 2299 base::Bind(&NetLogSpdyPingCallback, unique_id, "received"));
2300 2300
2301 // Send response to a PING from server. 2301 // Send response to a PING from server.
2302 if (unique_id % 2 == 0) { 2302 if (unique_id % 2 == 0) {
2303 WritePingFrame(unique_id); 2303 // TODO(akalin): Reply to pings once we can distinguish them from
2304 // pongs.
2305 // WritePingFrame(unique_id);
2304 return; 2306 return;
2305 } 2307 }
2306 2308
2307 --pings_in_flight_; 2309 --pings_in_flight_;
2308 if (pings_in_flight_ < 0) { 2310 if (pings_in_flight_ < 0) {
2309 RecordProtocolErrorHistogram(PROTOCOL_ERROR_UNEXPECTED_PING); 2311 RecordProtocolErrorHistogram(PROTOCOL_ERROR_UNEXPECTED_PING);
2310 CloseSessionResult result = 2312 CloseSessionResult result =
2311 DoCloseSession(ERR_SPDY_PROTOCOL_ERROR, "pings_in_flight_ is < 0."); 2313 DoCloseSession(ERR_SPDY_PROTOCOL_ERROR, "pings_in_flight_ is < 0.");
2312 DCHECK_EQ(result, SESSION_CLOSED_BUT_NOT_REMOVED); 2314 DCHECK_EQ(result, SESSION_CLOSED_BUT_NOT_REMOVED);
2313 pings_in_flight_ = 0; 2315 pings_in_flight_ = 0;
(...skipping 24 matching lines...) Expand all
2338 if (stream_id == kSessionFlowControlStreamId) { 2340 if (stream_id == kSessionFlowControlStreamId) {
2339 // WINDOW_UPDATE for the session. 2341 // WINDOW_UPDATE for the session.
2340 if (flow_control_state_ < FLOW_CONTROL_STREAM_AND_SESSION) { 2342 if (flow_control_state_ < FLOW_CONTROL_STREAM_AND_SESSION) {
2341 LOG(WARNING) << "Received WINDOW_UPDATE for session when " 2343 LOG(WARNING) << "Received WINDOW_UPDATE for session when "
2342 << "session flow control is not turned on"; 2344 << "session flow control is not turned on";
2343 // TODO(akalin): Record an error and close the session. 2345 // TODO(akalin): Record an error and close the session.
2344 return; 2346 return;
2345 } 2347 }
2346 2348
2347 if (delta_window_size < 1u) { 2349 if (delta_window_size < 1u) {
2350 // TODO(akalin): Implement END_FLOW_CONTROL handling.
2351 /*
2348 RecordProtocolErrorHistogram(PROTOCOL_ERROR_INVALID_WINDOW_UPDATE_SIZE); 2352 RecordProtocolErrorHistogram(PROTOCOL_ERROR_INVALID_WINDOW_UPDATE_SIZE);
2349 CloseSessionResult result = DoCloseSession( 2353 CloseSessionResult result = DoCloseSession(
2350 ERR_SPDY_PROTOCOL_ERROR, 2354 ERR_SPDY_PROTOCOL_ERROR,
2351 "Received WINDOW_UPDATE with an invalid delta_window_size " + 2355 "Received WINDOW_UPDATE with an invalid delta_window_size " +
2352 base::UintToString(delta_window_size)); 2356 base::UintToString(delta_window_size));
2353 DCHECK_EQ(result, SESSION_CLOSED_BUT_NOT_REMOVED); 2357 DCHECK_EQ(result, SESSION_CLOSED_BUT_NOT_REMOVED);
2358 */
2354 return; 2359 return;
2355 } 2360 }
2356 2361
2357 IncreaseSendWindowSize(static_cast<int32>(delta_window_size)); 2362 IncreaseSendWindowSize(static_cast<int32>(delta_window_size));
2358 } else { 2363 } else {
2359 // WINDOW_UPDATE for a stream. 2364 // WINDOW_UPDATE for a stream.
2360 if (flow_control_state_ < FLOW_CONTROL_STREAM) { 2365 if (flow_control_state_ < FLOW_CONTROL_STREAM) {
2361 // TODO(akalin): Record an error and close the session. 2366 // TODO(akalin): Record an error and close the session.
2362 LOG(WARNING) << "Received WINDOW_UPDATE for stream " << stream_id 2367 LOG(WARNING) << "Received WINDOW_UPDATE for stream " << stream_id
2363 << " when flow control is not turned on"; 2368 << " when flow control is not turned on";
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
2931 if (!queue->empty()) { 2936 if (!queue->empty()) {
2932 SpdyStreamId stream_id = queue->front(); 2937 SpdyStreamId stream_id = queue->front();
2933 queue->pop_front(); 2938 queue->pop_front();
2934 return stream_id; 2939 return stream_id;
2935 } 2940 }
2936 } 2941 }
2937 return 0; 2942 return 0;
2938 } 2943 }
2939 2944
2940 } // namespace net 2945 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_session.h ('k') | net/spdy/spdy_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698