Better HTTP max_wait calculation.
GitOrigin-RevId: 36a149e8d4a2b46ee5e2d23514a8a78d6ad696fc
This commit is contained in:
parent
83e28b8ebc
commit
5e6672ee26
@ -800,8 +800,8 @@ void SessionConnection::flush_packet() {
|
||||
if (mode_ == Mode::HttpLongPoll) {
|
||||
max_delay = HTTP_MAX_DELAY;
|
||||
max_after = HTTP_MAX_AFTER;
|
||||
max_wait = min(http_max_wait(),
|
||||
static_cast<int>(1000 * max(0.1, ping_disconnect_delay() + last_pong_at_ - Time::now_cached() - 1)));
|
||||
auto time_to_disconnect = ping_disconnect_delay() + last_pong_at_ - Time::now_cached();
|
||||
max_wait = min(http_max_wait(), static_cast<int>(1000 * max(0.1, time_to_disconnect - rtt())));
|
||||
} else if (mode_ == Mode::Http) {
|
||||
max_delay = HTTP_MAX_DELAY;
|
||||
max_after = HTTP_MAX_AFTER;
|
||||
|
@ -125,7 +125,7 @@ class SessionConnection
|
||||
bool online_flag_ = false;
|
||||
|
||||
int rtt() const {
|
||||
return max(2, static_cast<int>(raw_connection_->rtt_ * 1.5));
|
||||
return max(2, static_cast<int>(raw_connection_->rtt_ * 1.5 + 1));
|
||||
}
|
||||
|
||||
int32 ping_disconnect_delay() const {
|
||||
|
Loading…
Reference in New Issue
Block a user