Improve client shutdown robustness

This commit is contained in:
Keith Winstein
2011-09-30 03:01:14 -04:00
parent 0d85b410fe
commit 31577a1c16
4 changed files with 39 additions and 3 deletions
+3 -1
View File
@@ -55,6 +55,7 @@ namespace Network {
bool verbose;
bool shutdown_in_progress;
uint64_t shutdown_timestamp;
/* information about receiver state */
uint64_t ack_num;
@@ -80,7 +81,7 @@ namespace Network {
void set_data_ack( void ) { pending_data_ack = true; }
/* Starts shutdown sequence */
void start_shutdown( void ) { shutdown_in_progress = true; }
void start_shutdown( void ) { shutdown_in_progress = true; shutdown_timestamp = timestamp(); }
/* Misc. getters and setters */
/* Cannot modify current_state while shutdown in progress */
@@ -91,6 +92,7 @@ namespace Network {
bool get_shutdown_in_progress( void ) { return shutdown_in_progress; }
bool get_shutdown_acknowledged( void ) { return sent_states.front().num == uint64_t(-1); }
bool get_counterparty_shutdown_acknowledged( void ) { return fragmenter.last_ack_sent() == uint64_t(-1); }
bool shutdown_ack_timed_out( void );
/* nonexistent methods to satisfy -Weffc++ */
TransportSender( const TransportSender &x );