Index: net/spdy/spdy_session.cc |
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc |
index a2249cb19c98d88b20a98a1de62e88665335a81a..92a4364449def0615ee3e1a5c465662754a6ff50 100644 |
--- a/net/spdy/spdy_session.cc |
+++ b/net/spdy/spdy_session.cc |
@@ -349,6 +349,7 @@ SpdySession::SpdySession(const HostPortProxyPair& host_port_proxy_pair, |
read_buffer_(new IOBuffer(kReadBufferSize)), |
read_pending_(false), |
stream_hi_water_mark_(1), // Always start at 1 for the first stream id. |
+ last_syn_stream_id_(0), |
write_pending_(false), |
delayed_write_pending_(false), |
is_secure_(false), |
@@ -1035,6 +1036,25 @@ void SpdySession::WriteSocket() { |
// which is now. At this time, we don't compress our data frames. |
SpdyFrame uncompressed_frame(next_buffer.buffer()->data(), false); |
size_t size; |
+ if (uncompressed_frame.is_control_frame()) { |
+ SpdyControlFrame control_frame(next_buffer.buffer()->data(), false); |
+ if (control_frame.type() == SYN_STREAM) { |
+ SpdySynStreamControlFrame syn_stream(next_buffer.buffer()->data(), |
+ false); |
+ SpdyStreamId id = syn_stream.stream_id(); |
+ DCHECK(IsStreamActive(id)); |
+ if (id < last_syn_stream_id_) { |
+ // need to play some games to change the stream_id |
+ scoped_refptr<SpdyStream> stream = active_streams_[id]; |
+ active_streams_.erase(id); |
+ id = GetNewStreamId(); |
+ syn_stream.set_stream_id(id); |
+ stream->set_stream_id(id); |
+ ActivateStream(stream); |
+ } |
+ last_syn_stream_id_ = id; |
+ } |
+ } |
if (buffered_spdy_framer_->IsCompressible(uncompressed_frame)) { |
DCHECK(uncompressed_frame.is_control_frame()); |
scoped_ptr<SpdyFrame> compressed_frame( |