diff options
author | Keith Winstein <keithw@mit.edu> | 2012-03-07 04:01:18 -0500 |
---|---|---|
committer | Keith Winstein <keithw@mit.edu> | 2012-03-07 04:09:40 -0500 |
commit | dc1c49975fffcf10ec97b9b93cbf1bdfb17510eb (patch) | |
tree | b3747992cb52fb64c2c1f360b4008e2188bbbe44 /src | |
parent | 562ab991c842ea005d13ba0323a463e795f84775 (diff) |
Underline when empirical delay gets >500ms, even if SRTT hasn't (fixes #35)
Diffstat (limited to 'src')
-rw-r--r-- | src/frontend/terminaloverlay.cc | 14 | ||||
-rw-r--r-- | src/frontend/terminaloverlay.h | 4 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/frontend/terminaloverlay.cc b/src/frontend/terminaloverlay.cc index d0ec99b..de16828 100644 --- a/src/frontend/terminaloverlay.cc +++ b/src/frontend/terminaloverlay.cc @@ -382,13 +382,18 @@ void PredictionEngine::cull( const Framebuffer &fb ) srtt_trigger = false; } - /* control flagging with hysteresis */ + /* control underlining with hysteresis */ if ( send_interval > FLAG_TRIGGER_HIGH ) { flagging = true; } else if ( send_interval <= FLAG_TRIGGER_LOW ) { flagging = false; } + /* really big glitches also activate underlining */ + if ( glitch_trigger > GLITCH_REPAIR_COUNT ) { + flagging = true; + } + /* go through cell predictions */ BOOST_AUTO( i, overlays.begin() ); @@ -473,8 +478,11 @@ void PredictionEngine::cull( const Framebuffer &fb ) case Pending: /* When a prediction takes a long time to be confirmed, we activate the predictions even if SRTT is low */ - if ( (now - j->prediction_time) >= GLITCH_THRESHOLD ) { - glitch_trigger = GLITCH_REPAIR_COUNT; + if ( (now - j->prediction_time) >= GLITCH_FLAG_THRESHOLD ) { + glitch_trigger = GLITCH_REPAIR_COUNT * 2; /* display and underline */ + } else if ( ((now - j->prediction_time) >= GLITCH_THRESHOLD) + && (glitch_trigger < GLITCH_REPAIR_COUNT) ) { + glitch_trigger = GLITCH_REPAIR_COUNT; /* just display */ } break; diff --git a/src/frontend/terminaloverlay.h b/src/frontend/terminaloverlay.h index 54ca18b..371b476 100644 --- a/src/frontend/terminaloverlay.h +++ b/src/frontend/terminaloverlay.h @@ -152,6 +152,8 @@ namespace Overlay { static const uint64_t GLITCH_REPAIR_COUNT = 10; /* non-glitches required to cure glitch trigger */ static const uint64_t GLITCH_REPAIR_MININTERVAL = 150; /* required time in between non-glitches */ + static const uint64_t GLITCH_FLAG_THRESHOLD = 500; /* prediction outstanding this long => underline */ + char last_byte; Parser::UTF8Parser parser; @@ -172,7 +174,7 @@ namespace Overlay { bool flagging; /* whether we are underlining predictions */ bool srtt_trigger; /* show predictions because of slow round trip time */ - int glitch_trigger; /* show predictions temporarily because of long-pending prediction */ + unsigned int glitch_trigger; /* show predictions temporarily because of long-pending prediction */ uint64_t last_quick_confirmation; ConditionalCursorMove & cursor( void ) { assert( !cursors.empty() ); return cursors.back(); } |