Put spin debug under -vv flag, and add to mosh-client

This commit is contained in:
John Hood
2016-10-29 01:41:21 -04:00
parent f89f1da0b5
commit 9ffbeddbc8
13 changed files with 47 additions and 23 deletions
+6 -2
View File
@@ -99,6 +99,7 @@ int mosh_main( int argc, char *argv[] )
int main( int argc, char *argv[] )
#endif
{
unsigned int verbose = 0;
/* For security, make sure we don't dump core */
Crypto::disable_dumping_core();
@@ -107,7 +108,7 @@ int main( int argc, char *argv[] )
/* Get arguments */
int opt;
while ( (opt = getopt( argc, argv, "#:c" )) != -1 ) {
while ( (opt = getopt( argc, argv, "#:cv" )) != -1 ) {
switch ( opt ) {
case '#':
// Ignore the original arguments to mosh wrapper
@@ -116,6 +117,9 @@ int main( int argc, char *argv[] )
print_colorcount();
exit( 0 );
break;
case 'v':
verbose++;
break;
default:
usage( argv[ 0 ] );
exit( 1 );
@@ -168,7 +172,7 @@ int main( int argc, char *argv[] )
bool success = false;
try {
STMClient client( ip, desired_port, key, predict_mode );
STMClient client( ip, desired_port, key, predict_mode, verbose );
client.init();
try {
+7 -8
View File
@@ -102,7 +102,7 @@ static void serve( int host_fd,
static int run_server( const char *desired_ip, const char *desired_port,
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;
@@ -171,7 +171,7 @@ int main( int argc, char *argv[] )
string command_path;
char **command_argv = NULL;
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. */
list<string> locale_vars;
@@ -231,7 +231,7 @@ int main( int argc, char *argv[] )
}
break;
case 'v':
verbose = true;
verbose++;
break;
case 'l':
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,
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 */
long network_timeout = 0;
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;
ServerConnection *network = new ServerConnection( terminal, blank, desired_ip, desired_port );
if ( verbose ) {
network->set_verbose();
}
network->set_verbose( verbose );
Select::set_verbose( verbose );
/*
* 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;
/* close file descriptors */
if ( !verbose ) {
if ( verbose == 0 ) {
/* Necessary to properly detach on old versions of sshd (e.g. RHEL/CentOS 5.0). */
int nullfd;
+4
View File
@@ -255,6 +255,10 @@ void STMClient::main_init( void )
/* tell server the size of the terminal */
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 )
+4 -2
View File
@@ -66,6 +66,7 @@ private:
std::wstring connecting_notification;
bool repaint_requested, lf_entered, quit_sequence_started;
bool clean_shutdown;
unsigned int verbose;
void main_init( void );
void process_network_input( void );
@@ -83,7 +84,7 @@ private:
void resume( void ); /* restore state after SIGCONT */
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 : "" ),
key( s_key ? s_key : "" ),
escape_key( 0x1E ), escape_pass_key( '^' ), escape_pass_key2( '^' ),
@@ -99,7 +100,8 @@ public:
repaint_requested( false ),
lf_entered( false ),
quit_sequence_started( false ),
clean_shutdown( false )
clean_shutdown( false ),
verbose( s_verbose )
{
if ( predict_mode ) {
if ( !strcmp( predict_mode, "always" ) ) {