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

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

Issue 8230037: Send PING to check the status of the SPDY connection. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // TODO(rtenhove) clean up frame buffer size calculations so that we aren't 5 // TODO(rtenhove) clean up frame buffer size calculations so that we aren't
6 // constantly adding and subtracting header sizes; this is ugly and error- 6 // constantly adding and subtracting header sizes; this is ugly and error-
7 // prone. 7 // prone.
8 8
9 #include "net/spdy/spdy_framer.h" 9 #include "net/spdy/spdy_framer.h"
10 10
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 reinterpret_cast<const SpdyControlFrame&>(frame); 828 reinterpret_cast<const SpdyControlFrame&>(frame);
829 return control_frame.type() == SYN_STREAM || 829 return control_frame.type() == SYN_STREAM ||
830 control_frame.type() == SYN_REPLY; 830 control_frame.type() == SYN_REPLY;
831 } 831 }
832 832
833 const SpdyDataFrame& data_frame = 833 const SpdyDataFrame& data_frame =
834 reinterpret_cast<const SpdyDataFrame&>(frame); 834 reinterpret_cast<const SpdyDataFrame&>(frame);
835 return (data_frame.flags() & DATA_FLAG_COMPRESSED) != 0; 835 return (data_frame.flags() & DATA_FLAG_COMPRESSED) != 0;
836 } 836 }
837 837
838 bool SpdyFramer::IsPingFrame(const SpdyFrame& frame) const {
839 if (frame.is_control_frame()) {
840 const SpdyControlFrame& control_frame =
841 reinterpret_cast<const SpdyControlFrame&>(frame);
842 return control_frame.type() == PING;
843 }
844 return false;
845 }
846
838 const char* SpdyFramer::StateToString(int state) { 847 const char* SpdyFramer::StateToString(int state) {
839 switch (state) { 848 switch (state) {
840 case SPDY_ERROR: 849 case SPDY_ERROR:
841 return "ERROR"; 850 return "ERROR";
842 case SPDY_DONE: 851 case SPDY_DONE:
843 return "DONE"; 852 return "DONE";
844 case SPDY_AUTO_RESET: 853 case SPDY_AUTO_RESET:
845 return "AUTO_RESET"; 854 return "AUTO_RESET";
846 case SPDY_RESET: 855 case SPDY_RESET:
847 return "RESET"; 856 return "RESET";
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after
1691 } else { 1700 } else {
1692 frame_size = SpdyFrame::size(); 1701 frame_size = SpdyFrame::size();
1693 *header_length = frame_size; 1702 *header_length = frame_size;
1694 *payload_length = frame.length(); 1703 *payload_length = frame.length();
1695 *payload = frame.data() + SpdyFrame::size(); 1704 *payload = frame.data() + SpdyFrame::size();
1696 } 1705 }
1697 return true; 1706 return true;
1698 } 1707 }
1699 1708
1700 } // namespace spdy 1709 } // namespace spdy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698