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

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

Issue 10382107: Change the stream_id for streams which are serialized out of order. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix comments Created 8 years, 7 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_session_spdy2_unittest.cc » ('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 <map> 7 #include <map>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 dict->SetInteger("flags", flags_); 60 dict->SetInteger("flags", flags_);
61 dict->Set("headers", headers_list); 61 dict->Set("headers", headers_list);
62 dict->SetInteger("stream_id", stream_id_); 62 dict->SetInteger("stream_id", stream_id_);
63 if (associated_stream_) 63 if (associated_stream_)
64 dict->SetInteger("associated_stream", associated_stream_); 64 dict->SetInteger("associated_stream", associated_stream_);
65 return dict; 65 return dict;
66 } 66 }
67 67
68 NetLogSpdySynParameter::~NetLogSpdySynParameter() {} 68 NetLogSpdySynParameter::~NetLogSpdySynParameter() {}
69 69
70 NetLogSpdySynRenumberParameter::NetLogSpdySynRenumberParameter(
71 SpdyStreamId old_id,
72 SpdyStreamId new_id)
73 : old_id_(old_id),
74 new_id_(new_id) {
75 }
76
77 Value* NetLogSpdySynRenumberParameter::ToValue() const {
78 DictionaryValue* dict = new DictionaryValue();
79 dict->SetInteger("old_id", old_id_);
80 dict->SetInteger("new_id", new_id_);
81 return dict;
82 }
83
84 NetLogSpdySynRenumberParameter::~NetLogSpdySynRenumberParameter() {}
85
86
70 NetLogSpdyCredentialParameter::NetLogSpdyCredentialParameter( 87 NetLogSpdyCredentialParameter::NetLogSpdyCredentialParameter(
71 size_t slot, 88 size_t slot,
72 const std::string& origin) 89 const std::string& origin)
73 : slot_(slot), 90 : slot_(slot),
74 origin_(origin) { 91 origin_(origin) {
75 } 92 }
76 93
77 Value* NetLogSpdyCredentialParameter::ToValue() const { 94 Value* NetLogSpdyCredentialParameter::ToValue() const {
78 DictionaryValue* dict = new DictionaryValue(); 95 DictionaryValue* dict = new DictionaryValue();
79 dict->SetInteger("slot", slot_); 96 dict->SetInteger("slot", slot_);
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 const HostPortPair& trusted_spdy_proxy, 358 const HostPortPair& trusted_spdy_proxy,
342 NetLog* net_log) 359 NetLog* net_log)
343 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), 360 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
344 host_port_proxy_pair_(host_port_proxy_pair), 361 host_port_proxy_pair_(host_port_proxy_pair),
345 spdy_session_pool_(spdy_session_pool), 362 spdy_session_pool_(spdy_session_pool),
346 http_server_properties_(http_server_properties), 363 http_server_properties_(http_server_properties),
347 connection_(new ClientSocketHandle), 364 connection_(new ClientSocketHandle),
348 read_buffer_(new IOBuffer(kReadBufferSize)), 365 read_buffer_(new IOBuffer(kReadBufferSize)),
349 read_pending_(false), 366 read_pending_(false),
350 stream_hi_water_mark_(1), // Always start at 1 for the first stream id. 367 stream_hi_water_mark_(1), // Always start at 1 for the first stream id.
368 last_syn_stream_id_(0),
351 write_pending_(false), 369 write_pending_(false),
352 delayed_write_pending_(false), 370 delayed_write_pending_(false),
353 is_secure_(false), 371 is_secure_(false),
354 certificate_error_code_(OK), 372 certificate_error_code_(OK),
355 error_(OK), 373 error_(OK),
356 state_(IDLE), 374 state_(IDLE),
357 max_concurrent_streams_(g_init_max_concurrent_streams), 375 max_concurrent_streams_(g_init_max_concurrent_streams),
358 streams_initiated_count_(0), 376 streams_initiated_count_(0),
359 streams_pushed_count_(0), 377 streams_pushed_count_(0),
360 streams_pushed_and_claimed_count_(0), 378 streams_pushed_and_claimed_count_(0),
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 while (in_flight_write_.buffer() || !queue_.empty()) { 1027 while (in_flight_write_.buffer() || !queue_.empty()) {
1010 if (!in_flight_write_.buffer()) { 1028 if (!in_flight_write_.buffer()) {
1011 // Grab the next SpdyFrame to send. 1029 // Grab the next SpdyFrame to send.
1012 SpdyIOBuffer next_buffer = queue_.top(); 1030 SpdyIOBuffer next_buffer = queue_.top();
1013 queue_.pop(); 1031 queue_.pop();
1014 1032
1015 // We've deferred compression until just before we write it to the socket, 1033 // We've deferred compression until just before we write it to the socket,
1016 // which is now. At this time, we don't compress our data frames. 1034 // which is now. At this time, we don't compress our data frames.
1017 SpdyFrame uncompressed_frame(next_buffer.buffer()->data(), false); 1035 SpdyFrame uncompressed_frame(next_buffer.buffer()->data(), false);
1018 size_t size; 1036 size_t size;
1037 if (uncompressed_frame.is_control_frame()) {
1038 SpdyControlFrame control_frame(next_buffer.buffer()->data(), false);
1039 if (control_frame.type() == SYN_STREAM) {
1040 SpdySynStreamControlFrame syn_stream(next_buffer.buffer()->data(),
1041 false);
1042 SpdyStreamId id = syn_stream.stream_id();
1043 DCHECK(IsStreamActive(id));
1044 if (id < last_syn_stream_id_) {
1045 SpdyStreamId old_id = id;
1046 // need to play some games to change the stream_id
1047 scoped_refptr<SpdyStream> stream = active_streams_[id];
1048 active_streams_.erase(id);
1049 id = GetNewStreamId();
1050 syn_stream.set_stream_id(id);
1051 stream->set_stream_id(id);
1052 ActivateStream(stream);
1053
1054 if (net_log().IsLoggingAllEvents()) {
1055 net_log().AddEvent(
1056 NetLog::TYPE_SPDY_SESSION_SYN_STREAM_RENUMBER,
1057 make_scoped_refptr(
1058 new NetLogSpdySynRenumberParameter(old_id, id)));
1059 }
1060 }
1061 last_syn_stream_id_ = id;
1062 }
1063 }
1019 if (buffered_spdy_framer_->IsCompressible(uncompressed_frame)) { 1064 if (buffered_spdy_framer_->IsCompressible(uncompressed_frame)) {
1020 DCHECK(uncompressed_frame.is_control_frame()); 1065 DCHECK(uncompressed_frame.is_control_frame());
1021 scoped_ptr<SpdyFrame> compressed_frame( 1066 scoped_ptr<SpdyFrame> compressed_frame(
1022 buffered_spdy_framer_->CompressControlFrame( 1067 buffered_spdy_framer_->CompressControlFrame(
1023 reinterpret_cast<const SpdyControlFrame&>(uncompressed_frame))); 1068 reinterpret_cast<const SpdyControlFrame&>(uncompressed_frame)));
1024 if (!compressed_frame.get()) { 1069 if (!compressed_frame.get()) {
1025 RecordProtocolErrorHistogram( 1070 RecordProtocolErrorHistogram(
1026 PROTOCOL_ERROR_SPDY_COMPRESSION_FAILURE); 1071 PROTOCOL_ERROR_SPDY_COMPRESSION_FAILURE);
1027 CloseSessionOnError( 1072 CloseSessionOnError(
1028 net::ERR_SPDY_PROTOCOL_ERROR, true, "SPDY Compression failure."); 1073 net::ERR_SPDY_PROTOCOL_ERROR, true, "SPDY Compression failure.");
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after
1938 SSLClientSocket* SpdySession::GetSSLClientSocket() const { 1983 SSLClientSocket* SpdySession::GetSSLClientSocket() const {
1939 if (!is_secure_) 1984 if (!is_secure_)
1940 return NULL; 1985 return NULL;
1941 SSLClientSocket* ssl_socket = 1986 SSLClientSocket* ssl_socket =
1942 reinterpret_cast<SSLClientSocket*>(connection_->socket()); 1987 reinterpret_cast<SSLClientSocket*>(connection_->socket());
1943 DCHECK(ssl_socket); 1988 DCHECK(ssl_socket);
1944 return ssl_socket; 1989 return ssl_socket;
1945 } 1990 }
1946 1991
1947 } // namespace net 1992 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_session.h ('k') | net/spdy/spdy_session_spdy2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698