Display sendto() exception until a successful send
This commit is contained in:
committed by
Keith Winstein
parent
c258e0bc4e
commit
02c04fbdaa
@@ -419,6 +419,8 @@ void STMClient::main( void )
|
||||
const Network::NetworkException *exn = network->get_send_exception();
|
||||
if ( exn ) {
|
||||
overlays.get_notification_engine().set_network_exception( *exn );
|
||||
} else {
|
||||
overlays.get_notification_engine().clear_network_exception();
|
||||
}
|
||||
} catch ( Network::NetworkException e ) {
|
||||
if ( !network->shutdown_in_progress() ) {
|
||||
|
||||
@@ -153,6 +153,7 @@ NotificationEngine::NotificationEngine()
|
||||
: last_word_from_server( timestamp() ),
|
||||
last_acked_state( timestamp() ),
|
||||
message(),
|
||||
message_is_network_exception( false ),
|
||||
message_expiration( -1 )
|
||||
{}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "terminalframebuffer.h"
|
||||
#include "network.h"
|
||||
#include "transportsender.h"
|
||||
#include "parser.h"
|
||||
|
||||
#include <vector>
|
||||
@@ -129,6 +130,7 @@ namespace Overlay {
|
||||
uint64_t last_word_from_server;
|
||||
uint64_t last_acked_state;
|
||||
wstring message;
|
||||
bool message_is_network_exception;
|
||||
uint64_t message_expiration;
|
||||
|
||||
public:
|
||||
@@ -150,13 +152,24 @@ namespace Overlay {
|
||||
} else {
|
||||
message_expiration = timestamp() + 1000;
|
||||
}
|
||||
message_is_network_exception = false;
|
||||
}
|
||||
|
||||
void set_network_exception( const NetworkException &e )
|
||||
{
|
||||
wchar_t tmp[ 128 ];
|
||||
swprintf( tmp, 128, L"%s: %s", e.function.c_str(), strerror( e.the_errno ) );
|
||||
set_notification_string( wstring( tmp ) );
|
||||
|
||||
message = tmp;
|
||||
message_is_network_exception = true;
|
||||
message_expiration = timestamp() + Network::ACK_INTERVAL + 100;
|
||||
}
|
||||
|
||||
void clear_network_exception()
|
||||
{
|
||||
if ( message_is_network_exception ) {
|
||||
set_notification_string( wstring( L"" ) );
|
||||
}
|
||||
}
|
||||
|
||||
NotificationEngine();
|
||||
|
||||
Reference in New Issue
Block a user