Cleanup UI around connect/shutdown
This commit is contained in:
+12
-2
@@ -255,8 +255,6 @@ void STMClient::main( void )
|
||||
pollfds[ 3 ].fd = shutdown_signal_fd;
|
||||
pollfds[ 3 ].events = POLLIN;
|
||||
|
||||
last_remote_num = network->get_remote_state_num();
|
||||
|
||||
while ( 1 ) {
|
||||
try {
|
||||
output_new_frame();
|
||||
@@ -333,11 +331,23 @@ void STMClient::main( void )
|
||||
break;
|
||||
}
|
||||
|
||||
static const wstring connecting_notification( L"Connecting..." );
|
||||
if ( (network->get_remote_state_num() == 0) && (!network->shutdown_in_progress()) ) {
|
||||
overlays.get_notification_engine().set_notification_string( connecting_notification );
|
||||
} else if ( (network->get_remote_state_num() != 0)
|
||||
&& (overlays.get_notification_engine().get_notification_string()
|
||||
== connecting_notification) ) {
|
||||
overlays.get_notification_engine().set_notification_string( L"" );
|
||||
}
|
||||
|
||||
network->tick();
|
||||
} catch ( Network::NetworkException e ) {
|
||||
if ( !network->shutdown_in_progress() ) {
|
||||
wchar_t tmp[ 128 ];
|
||||
swprintf( tmp, 128, L"%s: %s\r\n", e.function.c_str(), strerror( e.the_errno ) );
|
||||
overlays.get_notification_engine().set_notification_string( wstring( tmp ) );
|
||||
}
|
||||
|
||||
struct timespec req;
|
||||
req.tv_sec = 0;
|
||||
req.tv_nsec = 200000000; /* 0.2 sec */
|
||||
|
||||
@@ -24,7 +24,6 @@ private:
|
||||
Terminal::Framebuffer *local_framebuffer;
|
||||
Overlay::OverlayManager overlays;
|
||||
Network::Transport< Network::UserStream, Terminal::Complete > *network;
|
||||
uint64_t last_remote_num;
|
||||
|
||||
bool repaint_requested, quit_sequence_started;
|
||||
|
||||
@@ -44,7 +43,6 @@ public:
|
||||
local_framebuffer( NULL ),
|
||||
overlays(),
|
||||
network( NULL ),
|
||||
last_remote_num( -1 ),
|
||||
repaint_requested( false ),
|
||||
quit_sequence_started( false )
|
||||
{}
|
||||
|
||||
@@ -101,6 +101,7 @@ namespace Overlay {
|
||||
public:
|
||||
void apply( Framebuffer &fb ) const;
|
||||
void set_notification_string( const wstring s_message );
|
||||
const wstring &get_notification_string( void ) { return message; }
|
||||
void server_ping( uint64_t s_last_word );
|
||||
void render_notification( void );
|
||||
|
||||
|
||||
+4
-4
@@ -242,6 +242,10 @@ void TransportSender<MyState>::send_in_fragments( string diff, uint64_t new_num
|
||||
inst.set_throwaway_num( sent_states.front().num );
|
||||
inst.set_diff( diff );
|
||||
|
||||
if ( new_num == uint64_t(-1) ) {
|
||||
shutdown_tries++;
|
||||
}
|
||||
|
||||
vector<Fragment> fragments = fragmenter.make_fragments( inst, connection->get_MTU() );
|
||||
|
||||
for ( auto i = fragments.begin(); i != fragments.end(); i++ ) {
|
||||
@@ -257,10 +261,6 @@ void TransportSender<MyState>::send_in_fragments( string diff, uint64_t new_num
|
||||
|
||||
}
|
||||
|
||||
if ( new_num == uint64_t(-1) ) {
|
||||
shutdown_tries++;
|
||||
}
|
||||
|
||||
pending_data_ack = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user