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

Unified Diff: net/quic/quic_session.cc

Issue 1009543004: Create a Perspective enum to use instead of a bool is_server to improve (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added NET_EXPORT_PRIVATE to fix compiler error Created 5 years, 9 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
« no previous file with comments | « net/quic/quic_session.h ('k') | net/quic/quic_session_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_session.cc
diff --git a/net/quic/quic_session.cc b/net/quic/quic_session.cc
index c8231a06f30483190b8d9109abe3970ff401e4ff..ac28ba8a9dcae5fe4532cf415682f5574d46b785 100644
--- a/net/quic/quic_session.cc
+++ b/net/quic/quic_session.cc
@@ -22,7 +22,8 @@ using std::vector;
namespace net {
-#define ENDPOINT (is_server() ? "Server: " : " Client: ")
+#define ENDPOINT \
+ (perspective() == Perspective::IS_SERVER ? "Server: " : " Client: ")
// We want to make sure we delete any closed streams in a safe manner.
// To avoid deleting a stream in mid-operation, we have a simple shim between
@@ -101,14 +102,14 @@ QuicSession::QuicSession(QuicConnection* connection, const QuicConfig& config)
visitor_shim_(new VisitorShim(this)),
config_(config),
max_open_streams_(config_.MaxStreamsPerConnection()),
- next_stream_id_(is_server() ? 2 : 5),
+ next_stream_id_(perspective() == Perspective::IS_SERVER ? 2 : 5),
write_blocked_streams_(true),
largest_peer_created_stream_id_(0),
error_(QUIC_NO_ERROR),
flow_controller_(new QuicFlowController(
connection_.get(),
0,
- is_server(),
+ perspective(),
kMinimumFlowControlSendWindow,
config_.GetInitialSessionFlowControlWindowToSend(),
config_.GetInitialSessionFlowControlWindowToSend())),
@@ -461,7 +462,7 @@ void QuicSession::OnConfigNegotiated() {
connection_->SetFromConfig(config_);
uint32 max_streams = config_.MaxStreamsPerConnection();
- if (is_server()) {
+ if (perspective() == Perspective::IS_SERVER) {
// A server should accept a small number of additional streams beyond the
// limit sent to the client. This helps avoid early connection termination
// when FIN/RSTs for old streams are lost or arrive out of order.
@@ -633,7 +634,7 @@ QuicDataStream* QuicSession::GetIncomingDataStream(QuicStreamId stream_id) {
return nullptr;
}
if (largest_peer_created_stream_id_ == 0) {
- if (is_server()) {
+ if (perspective() == Perspective::IS_SERVER) {
largest_peer_created_stream_id_ = 3;
} else {
largest_peer_created_stream_id_ = 1;
« no previous file with comments | « net/quic/quic_session.h ('k') | net/quic/quic_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698