Don't display blue "Connecting..." bar immediately
This commit is contained in:
@@ -293,7 +293,14 @@ void STMClient::main( void )
|
|||||||
try {
|
try {
|
||||||
output_new_frame();
|
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 ) {
|
if ( active_fds < 0 && errno == EINTR ) {
|
||||||
continue;
|
continue;
|
||||||
} else if ( active_fds < 0 ) {
|
} else if ( active_fds < 0 ) {
|
||||||
@@ -369,7 +376,9 @@ void STMClient::main( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const wstring connecting_notification( L"Connecting..." );
|
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 );
|
overlays.get_notification_engine().set_notification_string( connecting_notification );
|
||||||
} else if ( (network->get_remote_state_num() != 0)
|
} else if ( (network->get_remote_state_num() != 0)
|
||||||
&& (overlays.get_notification_engine().get_notification_string()
|
&& (overlays.get_notification_engine().get_notification_string()
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ private:
|
|||||||
|
|
||||||
void output_new_frame( void );
|
void output_new_frame( void );
|
||||||
|
|
||||||
|
bool still_connecting( void ) { return (network->get_remote_state_num() == 0); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
STMClient( const char *s_ip, int s_port, const char *s_key, const char *predict_mode )
|
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 ),
|
: ip( s_ip ), port( s_port ), key( s_key ),
|
||||||
|
|||||||
Reference in New Issue
Block a user