More robust shutdown handling

This commit is contained in:
Keith Winstein
2011-10-22 15:07:03 -04:00
parent b49e2b11d8
commit b29e3e9d39
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -246,10 +246,6 @@ void TransportSender<MyState>::send_in_fragments( string diff, uint64_t new_num
for ( auto i = fragments.begin(); i != fragments.end(); i++ ) { for ( auto i = fragments.begin(); i != fragments.end(); i++ ) {
connection->send( i->tostring() ); connection->send( i->tostring() );
if ( new_num == uint64_t(-1) ) {
shutdown_tries++;
}
if ( verbose ) { if ( verbose ) {
fprintf( stderr, "[%d] Sent [%d=>%d] id %d, frag %d ack=%d, throwaway=%d, len=%d, frame rate=%.2f, timeout=%d\n", fprintf( stderr, "[%d] Sent [%d=>%d] id %d, frag %d ack=%d, throwaway=%d, len=%d, frame rate=%.2f, timeout=%d\n",
(int)(timestamp() % 100000), (int)inst.old_num(), (int)inst.new_num(), (int)i->id, (int)i->fragment_num, (int)(timestamp() % 100000), (int)inst.old_num(), (int)inst.new_num(), (int)i->id, (int)i->fragment_num,
@@ -260,6 +256,10 @@ void TransportSender<MyState>::send_in_fragments( string diff, uint64_t new_num
} }
if ( new_num == uint64_t(-1) ) {
shutdown_tries++;
}
pending_data_ack = false; pending_data_ack = false;
} }
+1 -1
View File
@@ -19,7 +19,7 @@ namespace Network {
{ {
private: private:
/* timing parameters */ /* timing parameters */
static const int SEND_INTERVAL_MIN = 25; /* ms between frames */ static const int SEND_INTERVAL_MIN = 20; /* ms between frames */
static const int SEND_INTERVAL_MAX = 250; /* ms between frames */ static const int SEND_INTERVAL_MAX = 250; /* ms between frames */
static const int ACK_INTERVAL = 3000; /* ms between empty acks */ static const int ACK_INTERVAL = 3000; /* ms between empty acks */
static const int ACK_DELAY = 20; /* ms before delayed ack */ static const int ACK_DELAY = 20; /* ms before delayed ack */