diff --git a/src/frontend/stmclient.cc b/src/frontend/stmclient.cc index 94f1837..6f3e452 100644 --- a/src/frontend/stmclient.cc +++ b/src/frontend/stmclient.cc @@ -293,7 +293,14 @@ void STMClient::main( void ) try { output_new_frame(); - int active_fds = poll( pollfds, 3, min( network->wait_time(), overlays.wait_time() ) ); + int wait_time = min( network->wait_time(), overlays.wait_time() ); + + /* Handle startup "Connecting..." message */ + if ( still_connecting() ) { + wait_time = min( 250, wait_time ); + } + + int active_fds = poll( pollfds, 3, wait_time ); if ( active_fds < 0 && errno == EINTR ) { continue; } else if ( active_fds < 0 ) { @@ -369,7 +376,9 @@ void STMClient::main( void ) } static const wstring connecting_notification( L"Connecting..." ); - if ( (network->get_remote_state_num() == 0) && (!network->shutdown_in_progress()) ) { + if ( still_connecting() + && (!network->shutdown_in_progress()) + && (timestamp() - network->get_latest_remote_state().timestamp > 250) ) { overlays.get_notification_engine().set_notification_string( connecting_notification ); } else if ( (network->get_remote_state_num() != 0) && (overlays.get_notification_engine().get_notification_string() diff --git a/src/frontend/stmclient.h b/src/frontend/stmclient.h index 1da4b1d..35716ad 100644 --- a/src/frontend/stmclient.h +++ b/src/frontend/stmclient.h @@ -53,6 +53,8 @@ private: void output_new_frame( void ); + bool still_connecting( void ) { return (network->get_remote_state_num() == 0); } + public: STMClient( const char *s_ip, int s_port, const char *s_key, const char *predict_mode ) : ip( s_ip ), port( s_port ), key( s_key ),