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/linked_ptr.h" | 8 #include "base/linked_ptr.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 } | 1115 } |
1116 | 1116 |
1117 Respond(*headers, stream); | 1117 Respond(*headers, stream); |
1118 } | 1118 } |
1119 | 1119 |
1120 void SpdySession::OnControl(const spdy::SpdyControlFrame* frame) { | 1120 void SpdySession::OnControl(const spdy::SpdyControlFrame* frame) { |
1121 const linked_ptr<spdy::SpdyHeaderBlock> headers(new spdy::SpdyHeaderBlock); | 1121 const linked_ptr<spdy::SpdyHeaderBlock> headers(new spdy::SpdyHeaderBlock); |
1122 uint32 type = frame->type(); | 1122 uint32 type = frame->type(); |
1123 if (type == spdy::SYN_STREAM || type == spdy::SYN_REPLY) { | 1123 if (type == spdy::SYN_STREAM || type == spdy::SYN_REPLY) { |
1124 if (!spdy_framer_.ParseHeaderBlock(frame, headers.get())) { | 1124 if (!spdy_framer_.ParseHeaderBlock(frame, headers.get())) { |
1125 LOG(WARNING) << "Could not parse Spdy Control Frame Header"; | 1125 LOG(WARNING) << "Could not parse Spdy Control Frame Header."; |
1126 // TODO(mbelshe): Error the session? | 1126 int stream_id = 0; |
| 1127 if (type == spdy::SYN_STREAM) |
| 1128 stream_id = (reinterpret_cast<const spdy::SpdySynStreamControlFrame*> |
| 1129 (frame))->stream_id(); |
| 1130 if (type == spdy::SYN_REPLY) |
| 1131 stream_id = (reinterpret_cast<const spdy::SpdySynReplyControlFrame*> |
| 1132 (frame))->stream_id(); |
| 1133 if(IsStreamActive(stream_id)) |
| 1134 ResetStream(stream_id, spdy::PROTOCOL_ERROR); |
1127 return; | 1135 return; |
1128 } | 1136 } |
1129 } | 1137 } |
1130 | 1138 |
1131 switch (type) { | 1139 switch (type) { |
1132 case spdy::GOAWAY: | 1140 case spdy::GOAWAY: |
1133 OnGoAway(*reinterpret_cast<const spdy::SpdyGoAwayControlFrame*>(frame)); | 1141 OnGoAway(*reinterpret_cast<const spdy::SpdyGoAwayControlFrame*>(frame)); |
1134 break; | 1142 break; |
1135 case spdy::SETTINGS: | 1143 case spdy::SETTINGS: |
1136 OnSettings( | 1144 OnSettings( |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1320 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsRetransRate", | 1328 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsRetransRate", |
1321 setting.second, | 1329 setting.second, |
1322 1, 100, 50); | 1330 1, 100, 50); |
1323 break; | 1331 break; |
1324 } | 1332 } |
1325 } | 1333 } |
1326 } | 1334 } |
1327 } | 1335 } |
1328 | 1336 |
1329 } // namespace net | 1337 } // namespace net |
OLD | NEW |