|
|
@ -55,6 +55,9 @@ class TransportTargetWindowSizeMocker |
|
|
|
|
|
|
|
|
|
|
|
double ComputeNextTargetInitialWindowSizeFromPeriodicUpdate( |
|
|
|
double ComputeNextTargetInitialWindowSizeFromPeriodicUpdate( |
|
|
|
double /* current_target */) override { |
|
|
|
double /* current_target */) override { |
|
|
|
|
|
|
|
// Protecting access to variable window_size_ shared between client and
|
|
|
|
|
|
|
|
// server.
|
|
|
|
|
|
|
|
absl::MutexLock lock(&mu_); |
|
|
|
if (alternating_initial_window_sizes_) { |
|
|
|
if (alternating_initial_window_sizes_) { |
|
|
|
window_size_ = (window_size_ == kLargeInitialWindowSize) |
|
|
|
window_size_ = (window_size_ == kLargeInitialWindowSize) |
|
|
|
? kSmallInitialWindowSize |
|
|
|
? kSmallInitialWindowSize |
|
|
@ -66,17 +69,22 @@ class TransportTargetWindowSizeMocker |
|
|
|
// Alternates the initial window size targets. Computes a low values if it was
|
|
|
|
// Alternates the initial window size targets. Computes a low values if it was
|
|
|
|
// previously high, or a high value if it was previously low.
|
|
|
|
// previously high, or a high value if it was previously low.
|
|
|
|
void AlternateTargetInitialWindowSizes() { |
|
|
|
void AlternateTargetInitialWindowSizes() { |
|
|
|
|
|
|
|
absl::MutexLock lock(&mu_); |
|
|
|
alternating_initial_window_sizes_ = true; |
|
|
|
alternating_initial_window_sizes_ = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Reset() { |
|
|
|
void Reset() { |
|
|
|
|
|
|
|
// Protecting access to variable window_size_ shared between client and
|
|
|
|
|
|
|
|
// server.
|
|
|
|
|
|
|
|
absl::MutexLock lock(&mu_); |
|
|
|
alternating_initial_window_sizes_ = false; |
|
|
|
alternating_initial_window_sizes_ = false; |
|
|
|
window_size_ = kLargeInitialWindowSize; |
|
|
|
window_size_ = kLargeInitialWindowSize; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
private: |
|
|
|
bool alternating_initial_window_sizes_ = false; |
|
|
|
absl::Mutex mu_; |
|
|
|
double window_size_ = kLargeInitialWindowSize; |
|
|
|
bool alternating_initial_window_sizes_ ABSL_GUARDED_BY(mu_) = false; |
|
|
|
|
|
|
|
double window_size_ ABSL_GUARDED_BY(mu_) = kLargeInitialWindowSize; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
TransportTargetWindowSizeMocker* g_target_initial_window_size_mocker; |
|
|
|
TransportTargetWindowSizeMocker* g_target_initial_window_size_mocker; |
|
|
|