Put spin debug under -vv flag, and add to mosh-client
This commit is contained in:
@@ -20,6 +20,7 @@ mosh-client \- client-side helper for mosh
|
|||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
MOSH_KEY=KEY
|
MOSH_KEY=KEY
|
||||||
.B mosh-client
|
.B mosh-client
|
||||||
|
[\-v]
|
||||||
IP PORT
|
IP PORT
|
||||||
.br
|
.br
|
||||||
.B mosh-client
|
.B mosh-client
|
||||||
@@ -49,6 +50,11 @@ directly.
|
|||||||
With the \-c option, \fBmosh-client\fP instead prints the number of colors
|
With the \-c option, \fBmosh-client\fP instead prints the number of colors
|
||||||
of the terminal given by the TERM environment variable.
|
of the terminal given by the TERM environment variable.
|
||||||
|
|
||||||
|
The \-v option will print some debugging information on standard
|
||||||
|
error. More instances of this flag will result in more debugging
|
||||||
|
information. If standard error is not redirected from the terminal,
|
||||||
|
the display will be corrupted and quickly become unusable.
|
||||||
|
|
||||||
.SH ENVIRONMENT VARIABLES
|
.SH ENVIRONMENT VARIABLES
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
|
|||||||
+2
-1
@@ -62,7 +62,8 @@ hosts)
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B \-v
|
.B \-v
|
||||||
Print some debugging information even after detaching.
|
Print some debugging information even after detaching. More instances
|
||||||
|
of this flag will result in more debugging information.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B \-i \fIIP\fP
|
.B \-i \fIIP\fP
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ int mosh_main( int argc, char *argv[] )
|
|||||||
int main( int argc, char *argv[] )
|
int main( int argc, char *argv[] )
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
unsigned int verbose = 0;
|
||||||
/* For security, make sure we don't dump core */
|
/* For security, make sure we don't dump core */
|
||||||
Crypto::disable_dumping_core();
|
Crypto::disable_dumping_core();
|
||||||
|
|
||||||
@@ -107,7 +108,7 @@ int main( int argc, char *argv[] )
|
|||||||
|
|
||||||
/* Get arguments */
|
/* Get arguments */
|
||||||
int opt;
|
int opt;
|
||||||
while ( (opt = getopt( argc, argv, "#:c" )) != -1 ) {
|
while ( (opt = getopt( argc, argv, "#:cv" )) != -1 ) {
|
||||||
switch ( opt ) {
|
switch ( opt ) {
|
||||||
case '#':
|
case '#':
|
||||||
// Ignore the original arguments to mosh wrapper
|
// Ignore the original arguments to mosh wrapper
|
||||||
@@ -116,6 +117,9 @@ int main( int argc, char *argv[] )
|
|||||||
print_colorcount();
|
print_colorcount();
|
||||||
exit( 0 );
|
exit( 0 );
|
||||||
break;
|
break;
|
||||||
|
case 'v':
|
||||||
|
verbose++;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
usage( argv[ 0 ] );
|
usage( argv[ 0 ] );
|
||||||
exit( 1 );
|
exit( 1 );
|
||||||
@@ -168,7 +172,7 @@ int main( int argc, char *argv[] )
|
|||||||
|
|
||||||
bool success = false;
|
bool success = false;
|
||||||
try {
|
try {
|
||||||
STMClient client( ip, desired_port, key, predict_mode );
|
STMClient client( ip, desired_port, key, predict_mode, verbose );
|
||||||
client.init();
|
client.init();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ static void serve( int host_fd,
|
|||||||
|
|
||||||
static int run_server( const char *desired_ip, const char *desired_port,
|
static int run_server( const char *desired_ip, const char *desired_port,
|
||||||
const string &command_path, char *command_argv[],
|
const string &command_path, char *command_argv[],
|
||||||
const int colors, bool verbose, bool with_motd );
|
const int colors, unsigned int verbose, bool with_motd );
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ int main( int argc, char *argv[] )
|
|||||||
string command_path;
|
string command_path;
|
||||||
char **command_argv = NULL;
|
char **command_argv = NULL;
|
||||||
int colors = 0;
|
int colors = 0;
|
||||||
bool verbose = false; /* don't close stdin/stdout/stderr */
|
unsigned int verbose = 0; /* don't close stdin/stdout/stderr */
|
||||||
/* Will cause mosh-server not to correctly detach on old versions of sshd. */
|
/* Will cause mosh-server not to correctly detach on old versions of sshd. */
|
||||||
list<string> locale_vars;
|
list<string> locale_vars;
|
||||||
|
|
||||||
@@ -231,7 +231,7 @@ int main( int argc, char *argv[] )
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
verbose = true;
|
verbose++;
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
locale_vars.push_back( string( optarg ) );
|
locale_vars.push_back( string( optarg ) );
|
||||||
@@ -355,7 +355,7 @@ int main( int argc, char *argv[] )
|
|||||||
|
|
||||||
static int run_server( const char *desired_ip, const char *desired_port,
|
static int run_server( const char *desired_ip, const char *desired_port,
|
||||||
const string &command_path, char *command_argv[],
|
const string &command_path, char *command_argv[],
|
||||||
const int colors, bool verbose, bool with_motd ) {
|
const int colors, unsigned int verbose, bool with_motd ) {
|
||||||
/* get network idle timeout */
|
/* get network idle timeout */
|
||||||
long network_timeout = 0;
|
long network_timeout = 0;
|
||||||
char *timeout_envar = getenv( "MOSH_SERVER_NETWORK_TMOUT" );
|
char *timeout_envar = getenv( "MOSH_SERVER_NETWORK_TMOUT" );
|
||||||
@@ -403,9 +403,8 @@ static int run_server( const char *desired_ip, const char *desired_port,
|
|||||||
Network::UserStream blank;
|
Network::UserStream blank;
|
||||||
ServerConnection *network = new ServerConnection( terminal, blank, desired_ip, desired_port );
|
ServerConnection *network = new ServerConnection( terminal, blank, desired_ip, desired_port );
|
||||||
|
|
||||||
if ( verbose ) {
|
network->set_verbose( verbose );
|
||||||
network->set_verbose();
|
Select::set_verbose( verbose );
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If mosh-server is run on a pty, then typeahead may echo and break mosh.pl's
|
* If mosh-server is run on a pty, then typeahead may echo and break mosh.pl's
|
||||||
@@ -456,7 +455,7 @@ static int run_server( const char *desired_ip, const char *desired_port,
|
|||||||
int master;
|
int master;
|
||||||
|
|
||||||
/* close file descriptors */
|
/* close file descriptors */
|
||||||
if ( !verbose ) {
|
if ( verbose == 0 ) {
|
||||||
/* Necessary to properly detach on old versions of sshd (e.g. RHEL/CentOS 5.0). */
|
/* Necessary to properly detach on old versions of sshd (e.g. RHEL/CentOS 5.0). */
|
||||||
int nullfd;
|
int nullfd;
|
||||||
|
|
||||||
|
|||||||
@@ -255,6 +255,10 @@ void STMClient::main_init( void )
|
|||||||
|
|
||||||
/* tell server the size of the terminal */
|
/* tell server the size of the terminal */
|
||||||
network->get_current_state().push_back( Parser::Resize( window_size.ws_col, window_size.ws_row ) );
|
network->get_current_state().push_back( Parser::Resize( window_size.ws_col, window_size.ws_row ) );
|
||||||
|
|
||||||
|
/* be noisy as necessary */
|
||||||
|
network->set_verbose( verbose );
|
||||||
|
Select::set_verbose( verbose );
|
||||||
}
|
}
|
||||||
|
|
||||||
void STMClient::output_new_frame( void )
|
void STMClient::output_new_frame( void )
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ private:
|
|||||||
std::wstring connecting_notification;
|
std::wstring connecting_notification;
|
||||||
bool repaint_requested, lf_entered, quit_sequence_started;
|
bool repaint_requested, lf_entered, quit_sequence_started;
|
||||||
bool clean_shutdown;
|
bool clean_shutdown;
|
||||||
|
unsigned int verbose;
|
||||||
|
|
||||||
void main_init( void );
|
void main_init( void );
|
||||||
void process_network_input( void );
|
void process_network_input( void );
|
||||||
@@ -83,7 +84,7 @@ private:
|
|||||||
void resume( void ); /* restore state after SIGCONT */
|
void resume( void ); /* restore state after SIGCONT */
|
||||||
|
|
||||||
public:
|
public:
|
||||||
STMClient( const char *s_ip, const char *s_port, const char *s_key, const char *predict_mode )
|
STMClient( const char *s_ip, const char *s_port, const char *s_key, const char *predict_mode, unsigned int s_verbose )
|
||||||
: ip( s_ip ? s_ip : "" ), port( s_port ? s_port : "" ),
|
: ip( s_ip ? s_ip : "" ), port( s_port ? s_port : "" ),
|
||||||
key( s_key ? s_key : "" ),
|
key( s_key ? s_key : "" ),
|
||||||
escape_key( 0x1E ), escape_pass_key( '^' ), escape_pass_key2( '^' ),
|
escape_key( 0x1E ), escape_pass_key( '^' ), escape_pass_key2( '^' ),
|
||||||
@@ -99,7 +100,8 @@ public:
|
|||||||
repaint_requested( false ),
|
repaint_requested( false ),
|
||||||
lf_entered( false ),
|
lf_entered( false ),
|
||||||
quit_sequence_started( false ),
|
quit_sequence_started( false ),
|
||||||
clean_shutdown( false )
|
clean_shutdown( false ),
|
||||||
|
verbose( s_verbose )
|
||||||
{
|
{
|
||||||
if ( predict_mode ) {
|
if ( predict_mode ) {
|
||||||
if ( !strcmp( predict_mode, "always" ) ) {
|
if ( !strcmp( predict_mode, "always" ) ) {
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ Transport<MyState, RemoteState>::Transport( MyState &initial_state, RemoteState
|
|||||||
receiver_quench_timer( 0 ),
|
receiver_quench_timer( 0 ),
|
||||||
last_receiver_state( initial_remote ),
|
last_receiver_state( initial_remote ),
|
||||||
fragments(),
|
fragments(),
|
||||||
verbose( false )
|
verbose( 0 )
|
||||||
{
|
{
|
||||||
/* server */
|
/* server */
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,7 @@ Transport<MyState, RemoteState>::Transport( MyState &initial_state, RemoteState
|
|||||||
receiver_quench_timer( 0 ),
|
receiver_quench_timer( 0 ),
|
||||||
last_receiver_state( initial_remote ),
|
last_receiver_state( initial_remote ),
|
||||||
fragments(),
|
fragments(),
|
||||||
verbose( false )
|
verbose( 0 )
|
||||||
{
|
{
|
||||||
/* client */
|
/* client */
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ namespace Network {
|
|||||||
uint64_t receiver_quench_timer;
|
uint64_t receiver_quench_timer;
|
||||||
RemoteState last_receiver_state; /* the state we were in when user last queried state */
|
RemoteState last_receiver_state; /* the state we were in when user last queried state */
|
||||||
FragmentAssembly fragments;
|
FragmentAssembly fragments;
|
||||||
bool verbose;
|
unsigned int verbose;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Transport( MyState &initial_state, RemoteState &initial_remote,
|
Transport( MyState &initial_state, RemoteState &initial_remote,
|
||||||
@@ -106,7 +106,7 @@ namespace Network {
|
|||||||
|
|
||||||
const std::vector< int > fds( void ) const { return connection.fds(); }
|
const std::vector< int > fds( void ) const { return connection.fds(); }
|
||||||
|
|
||||||
void set_verbose( void ) { sender.set_verbose(); verbose = true; }
|
void set_verbose( unsigned int s_verbose ) { sender.set_verbose( s_verbose ); verbose = s_verbose; }
|
||||||
|
|
||||||
void set_send_delay( int new_delay ) { sender.set_send_delay( new_delay ); }
|
void set_send_delay( int new_delay ) { sender.set_send_delay( new_delay ); }
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ TransportSender<MyState>::TransportSender( Connection *s_connection, MyState &in
|
|||||||
fragmenter(),
|
fragmenter(),
|
||||||
next_ack_time( timestamp() ),
|
next_ack_time( timestamp() ),
|
||||||
next_send_time( timestamp() ),
|
next_send_time( timestamp() ),
|
||||||
verbose( false ),
|
verbose( 0 ),
|
||||||
shutdown_in_progress( false ),
|
shutdown_in_progress( false ),
|
||||||
shutdown_tries( 0 ),
|
shutdown_tries( 0 ),
|
||||||
shutdown_start( -1 ),
|
shutdown_start( -1 ),
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ namespace Network {
|
|||||||
|
|
||||||
void calculate_timers( void );
|
void calculate_timers( void );
|
||||||
|
|
||||||
bool verbose;
|
unsigned int verbose;
|
||||||
bool shutdown_in_progress;
|
bool shutdown_in_progress;
|
||||||
int shutdown_tries;
|
int shutdown_tries;
|
||||||
uint64_t shutdown_start;
|
uint64_t shutdown_start;
|
||||||
@@ -144,7 +144,7 @@ namespace Network {
|
|||||||
current_state = x;
|
current_state = x;
|
||||||
current_state.reset_input();
|
current_state.reset_input();
|
||||||
}
|
}
|
||||||
void set_verbose( void ) { verbose = true; }
|
void set_verbose( unsigned int s_verbose ) { verbose = s_verbose; }
|
||||||
|
|
||||||
bool get_shutdown_in_progress( void ) const { return shutdown_in_progress; }
|
bool get_shutdown_in_progress( void ) const { return shutdown_in_progress; }
|
||||||
bool get_shutdown_acknowledged( void ) const { return sent_states.front().num == uint64_t(-1); }
|
bool get_shutdown_acknowledged( void ) const { return sent_states.front().num == uint64_t(-1); }
|
||||||
|
|||||||
+1
-1
@@ -102,7 +102,7 @@ mosh_server()
|
|||||||
test_error "mosh_server: variables missing\n"
|
test_error "mosh_server: variables missing\n"
|
||||||
fi
|
fi
|
||||||
exec 2> "${MOSH_E2E_TEST}.server.stderr"
|
exec 2> "${MOSH_E2E_TEST}.server.stderr"
|
||||||
exec "$MOSH_SERVER" new -v $MOSH_SERVER_ARGS -@ "$@"
|
exec "$MOSH_SERVER" new -vv $MOSH_SERVER_ARGS -@ "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
# main
|
# main
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ fd_set Select::dummy_fd_set;
|
|||||||
|
|
||||||
sigset_t Select::dummy_sigset;
|
sigset_t Select::dummy_sigset;
|
||||||
|
|
||||||
|
unsigned int Select::verbose = 0;
|
||||||
|
|
||||||
void Select::handle_signal( int signum )
|
void Select::handle_signal( int signum )
|
||||||
{
|
{
|
||||||
fatal_assert( signum >= 0 );
|
fatal_assert( signum >= 0 );
|
||||||
|
|||||||
+8
-2
@@ -122,13 +122,16 @@ public:
|
|||||||
clear_got_signal();
|
clear_got_signal();
|
||||||
|
|
||||||
/* Rate-limit and warn about polls. */
|
/* Rate-limit and warn about polls. */
|
||||||
|
if ( verbose > 1 && timeout == 0 ) {
|
||||||
|
fprintf( stderr, "%s: got poll (timeout 0)\n", __func__ );
|
||||||
|
}
|
||||||
if ( timeout == 0 && ++consecutive_polls >= MAX_POLLS ) {
|
if ( timeout == 0 && ++consecutive_polls >= MAX_POLLS ) {
|
||||||
if ( consecutive_polls == MAX_POLLS ) {
|
if ( verbose > 1 && consecutive_polls == MAX_POLLS ) {
|
||||||
fprintf( stderr, "%s: got %d polls, rate limiting.\n", __func__, MAX_POLLS );
|
fprintf( stderr, "%s: got %d polls, rate limiting.\n", __func__, MAX_POLLS );
|
||||||
}
|
}
|
||||||
timeout = 1;
|
timeout = 1;
|
||||||
} else if ( timeout != 0 && consecutive_polls ) {
|
} else if ( timeout != 0 && consecutive_polls ) {
|
||||||
if ( consecutive_polls >= MAX_POLLS ) {
|
if ( verbose > 1 && consecutive_polls >= MAX_POLLS ) {
|
||||||
fprintf( stderr, "%s: got %d consecutive polls\n", __func__, consecutive_polls );
|
fprintf( stderr, "%s: got %d consecutive polls\n", __func__, consecutive_polls );
|
||||||
}
|
}
|
||||||
consecutive_polls = 0;
|
consecutive_polls = 0;
|
||||||
@@ -212,6 +215,8 @@ public:
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void set_verbose( unsigned int s_verbose ) { verbose = s_verbose; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int MAX_SIGNAL_NUMBER = 64;
|
static const int MAX_SIGNAL_NUMBER = 64;
|
||||||
/* Number of 0-timeout selects after which we begin to think
|
/* Number of 0-timeout selects after which we begin to think
|
||||||
@@ -233,6 +238,7 @@ private:
|
|||||||
static fd_set dummy_fd_set;
|
static fd_set dummy_fd_set;
|
||||||
static sigset_t dummy_sigset;
|
static sigset_t dummy_sigset;
|
||||||
int consecutive_polls;
|
int consecutive_polls;
|
||||||
|
static unsigned int verbose;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user