Add "experimental" mode to local echo (always predict even when incorrect)
This commit is contained in:
+6
-4
@@ -47,9 +47,10 @@ qq{Usage: $0 [options] [--] [user@]host [command...]
|
||||
--server=COMMAND mosh server on remote machine
|
||||
(default: "mosh-server")
|
||||
|
||||
--predict=adaptive local echo for slower links [default]
|
||||
-a --predict=always use local echo even on fast links
|
||||
-n --predict=never never use local echo
|
||||
--predict=adaptive local echo for slower links [default]
|
||||
-a --predict=always use local echo even on fast links
|
||||
-n --predict=never never use local echo
|
||||
--predict=experimental aggressively echo even when incorrect
|
||||
|
||||
-p NUM --port=NUM server-side UDP port
|
||||
|
||||
@@ -72,7 +73,8 @@ There is NO WARRANTY, to the extent permitted by law.\n};
|
||||
sub predict_check {
|
||||
my ( $predict, $env_set ) = @_;
|
||||
|
||||
if ( not exists { adaptive => 0, always => 0, never => 0 }->{ $predict } ) {
|
||||
if ( not exists { adaptive => 0, always => 0,
|
||||
never => 0, experimental => 0 }->{ $predict } ) {
|
||||
my $explanation = $env_set ? " (MOSH_PREDICTION_DISPLAY in environment)" : "";
|
||||
print STDERR qq{$0: Unknown mode \"$predict\"$explanation.\n\n};
|
||||
|
||||
|
||||
@@ -82,6 +82,8 @@ public:
|
||||
overlays.get_prediction_engine().set_display_preference( Overlay::PredictionEngine::Never );
|
||||
} else if ( !strcmp( predict_mode, "adaptive" ) ) {
|
||||
overlays.get_prediction_engine().set_display_preference( Overlay::PredictionEngine::Adaptive );
|
||||
} else if ( !strcmp( predict_mode, "experimental" ) ) {
|
||||
overlays.get_prediction_engine().set_display_preference( Overlay::PredictionEngine::Experimental );
|
||||
} else {
|
||||
fprintf( stderr, "Unknown prediction mode %s.\n", predict_mode );
|
||||
exit( 1 );
|
||||
|
||||
@@ -325,7 +325,8 @@ void PredictionEngine::apply( Framebuffer &fb ) const
|
||||
{
|
||||
bool show = (display_preference != Never) && ( srtt_trigger
|
||||
|| glitch_trigger
|
||||
|| (display_preference == Always) );
|
||||
|| (display_preference == Always)
|
||||
|| (display_preference == Experimental) );
|
||||
|
||||
if ( show ) {
|
||||
for ( cursors_type::const_iterator it = cursors.begin();
|
||||
@@ -461,7 +462,11 @@ void PredictionEngine::cull( const Framebuffer &fb )
|
||||
);
|
||||
*/
|
||||
|
||||
kill_epoch( j->tentative_until_epoch, fb );
|
||||
if ( display_preference == Experimental ) {
|
||||
j->reset();
|
||||
} else {
|
||||
kill_epoch( j->tentative_until_epoch, fb );
|
||||
}
|
||||
/*
|
||||
if ( j->display_time != uint64_t(-1) ) {
|
||||
fprintf( stderr, "TIMING %ld - %ld (TENT)\n", time(NULL), now - j->display_time );
|
||||
@@ -481,8 +486,12 @@ void PredictionEngine::cull( const Framebuffer &fb )
|
||||
}
|
||||
*/
|
||||
|
||||
reset();
|
||||
return;
|
||||
if ( display_preference == Experimental ) {
|
||||
j->reset();
|
||||
} else {
|
||||
reset();
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Correct:
|
||||
@@ -548,8 +557,12 @@ void PredictionEngine::cull( const Framebuffer &fb )
|
||||
cursor().expiration_time,
|
||||
now );
|
||||
*/
|
||||
reset();
|
||||
return;
|
||||
if ( display_preference == Experimental ) {
|
||||
cursors.clear();
|
||||
} else {
|
||||
reset();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -590,6 +603,8 @@ void PredictionEngine::new_user_byte( char the_byte, const Framebuffer &fb )
|
||||
{
|
||||
if ( display_preference == Never ) {
|
||||
return;
|
||||
} else if ( display_preference == Experimental ) {
|
||||
prediction_epoch = confirmed_epoch;
|
||||
}
|
||||
|
||||
cull( fb );
|
||||
@@ -810,7 +825,9 @@ void PredictionEngine::newline_carriage_return( const Framebuffer &fb )
|
||||
|
||||
void PredictionEngine::become_tentative( void )
|
||||
{
|
||||
prediction_epoch++;
|
||||
if ( display_preference != Experimental ) {
|
||||
prediction_epoch++;
|
||||
}
|
||||
|
||||
/*
|
||||
fprintf( stderr, "Now tentative in epoch %lu (confirmed=%lu)\n",
|
||||
|
||||
@@ -231,7 +231,8 @@ namespace Overlay {
|
||||
enum DisplayPreference {
|
||||
Always,
|
||||
Never,
|
||||
Adaptive
|
||||
Adaptive,
|
||||
Experimental
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user