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

Unified Diff: net/spdy/spdy_protocol.h

Issue 243643002: Refactor RST_STREAM status code handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: net/spdy/spdy_protocol.h
diff --git a/net/spdy/spdy_protocol.h b/net/spdy/spdy_protocol.h
index 9696bf120890a04a4d62da8e126615b3797361ca..b02339a155688a2fcd3303a6b2366ed00d74a71f 100644
--- a/net/spdy/spdy_protocol.h
+++ b/net/spdy/spdy_protocol.h
@@ -360,6 +360,7 @@ enum SpdyRstStreamStatus {
RST_STREAM_INVALID = 0,
RST_STREAM_PROTOCOL_ERROR = 1,
RST_STREAM_INVALID_STREAM = 2,
+ RST_STREAM_STREAM_CLOSED = 2, // Equivalent to INVALID_STREAM
RST_STREAM_REFUSED_STREAM = 3,
RST_STREAM_UNSUPPORTED_VERSION = 4,
RST_STREAM_CANCEL = 5,
@@ -369,7 +370,11 @@ enum SpdyRstStreamStatus {
RST_STREAM_STREAM_ALREADY_CLOSED = 9,
RST_STREAM_INVALID_CREDENTIALS = 10,
RST_STREAM_FRAME_TOO_LARGE = 11,
- RST_STREAM_NUM_STATUS_CODES = 12
+ RST_STREAM_FRAME_SIZE_ERROR = 11, // Equivalent to FRAME_TOO_LARGE
jar (doing other things) 2014/04/22 00:02:59 nit: If you're not going to distigiush them... why
Johnny 2014/04/22 00:31:27 Yea, this is not optimal, but: FRAME_TOO_LARGE is
jar (doing other things) 2014/04/25 16:03:45 OK... good enough. Might be worth a comment... bu
+ RST_STREAM_SETTINGS_TIMEOUT = 12,
+ RST_STREAM_CONNECT_ERROR = 13,
+ RST_STREAM_ENHANCE_YOUR_CALM = 14,
+ RST_STREAM_NUM_STATUS_CODES = 15
};
// Status codes for GOAWAY frames.
@@ -426,6 +431,26 @@ class NET_EXPORT_PRIVATE SpdyConstants {
// given protocol version.
// Returns -1 on failure (I.E. Invalid setting id for the given version).
static int SerializeSettingId(SpdyMajorVersion version, SpdySettingsIds id);
+
+ // Returns true if a given on-the-wire enumeration of a RST_STREAM status code
+ // is valid for a given protocol version, false otherwise.
+ static bool IsValidRstStreamStatus(SpdyMajorVersion version,
+ int rst_stream_status_field);
+
+ // Parses a RST_STREAM status code from an on-the-wire enumeration of a given
+ // protocol version.
+ // Behavior is undefined for invalid RST_STREAM status code fields; consumers
+ // should first use IsValidRstStreamStatus() to verify validity of RST_STREAM
+ // status code fields..
+ static SpdyRstStreamStatus ParseRstStreamStatus(SpdyMajorVersion version,
+ int rst_stream_status_field);
+
+ // Serializes a given RST_STREAM status code to the on-the-wire enumeration
+ // value for the given protocol version.
+ // Returns -1 on failure (I.E. Invalid RST_STREAM status code for the given
+ // version).
+ static int SerializeRstStreamStatus(SpdyMajorVersion version,
+ SpdyRstStreamStatus rst_stream_status);
};
class SpdyFrame;
@@ -636,8 +661,6 @@ class NET_EXPORT_PRIVATE SpdyRstStreamIR : public SpdyFrameWithStreamIdIR {
return status_;
}
void set_status(SpdyRstStreamStatus status) {
- DCHECK_NE(status, RST_STREAM_INVALID);
- DCHECK_LT(status, RST_STREAM_NUM_STATUS_CODES);
status_ = status;
}
« no previous file with comments | « net/spdy/spdy_framer_test.cc ('k') | net/spdy/spdy_protocol.cc » ('j') | net/spdy/spdy_session.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698