Rename 'attached' to 'has_remote_addr'

Even with future support for detaching and reattaching, this variable will keep
its original meaning.
This commit is contained in:
Keegan McAllister
2012-03-06 11:54:56 -08:00
parent d7f7e7c4ae
commit e35733a2c1
6 changed files with 16 additions and 16 deletions
+2 -2
View File
@@ -352,7 +352,7 @@ void serve( int host_fd, Terminal::Complete &terminal, ServerConnection &network
break;
}
if ( network.attached() && (!network.shutdown_in_progress()) ) {
if ( network.has_remote_addr() && (!network.shutdown_in_progress()) ) {
network.start_shutdown();
} else {
break;
@@ -368,7 +368,7 @@ void serve( int host_fd, Terminal::Complete &terminal, ServerConnection &network
if ( (pollfds[ 1 ].revents)
& (POLLERR | POLLHUP | POLLNVAL) ) {
/* host problem */
if ( network.attached() ) {
if ( network.has_remote_addr() ) {
network.start_shutdown();
} else {
break;
+4 -4
View File
@@ -211,7 +211,7 @@ bool STMClient::process_user_input( int fd )
if ( quit_sequence_started ) {
if ( the_byte == '.' ) { /* Quit sequence is Ctrl-^ . */
if ( network->attached() && (!network->shutdown_in_progress()) ) {
if ( network->has_remote_addr() && (!network->shutdown_in_progress()) ) {
overlays.get_notification_engine().set_notification_string( wstring( L"Exiting on user request..." ) );
network->start_shutdown();
return true;
@@ -312,7 +312,7 @@ void STMClient::main( void )
if ( pollfds[ 1 ].revents & POLLIN ) {
/* input from the user needs to be fed to the network */
if ( !process_user_input( pollfds[ 1 ].fd ) ) {
if ( !network->attached() ) {
if ( !network->has_remote_addr() ) {
break;
} else if ( !network->shutdown_in_progress() ) {
overlays.get_notification_engine().set_notification_string( wstring( L"Exiting..." ) );
@@ -337,7 +337,7 @@ void STMClient::main( void )
break;
}
if ( !network->attached() ) {
if ( !network->has_remote_addr() ) {
break;
} else if ( !network->shutdown_in_progress() ) {
overlays.get_notification_engine().set_notification_string( wstring( L"Signal received, shutting down..." ) );
@@ -354,7 +354,7 @@ void STMClient::main( void )
if ( (pollfds[ 1 ].revents)
& (POLLERR | POLLHUP | POLLNVAL) ) {
/* user problem */
if ( !network->attached() ) {
if ( !network->has_remote_addr() ) {
break;
} else if ( !network->shutdown_in_progress() ) {
overlays.get_notification_engine().set_notification_string( wstring( L"Exiting..." ) );
+5 -5
View File
@@ -105,9 +105,9 @@ void Connection::setup( void )
Connection::Connection( const char *desired_ip ) /* server */
: sock( -1 ),
has_remote_addr( false ),
remote_addr(),
server( true ),
attached( false ),
MTU( SEND_MTU ),
key(),
session( key ),
@@ -150,9 +150,9 @@ Connection::Connection( const char *desired_ip ) /* server */
Connection::Connection( const char *key_str, const char *ip, int port ) /* client */
: sock( -1 ),
has_remote_addr( false ),
remote_addr(),
server( false ),
attached( false ),
MTU( SEND_MTU ),
key( key_str ),
session( key ),
@@ -177,12 +177,12 @@ Connection::Connection( const char *key_str, const char *ip, int port ) /* clien
throw NetworkException( buffer, saved_errno );
}
attached = true;
has_remote_addr = true;
}
void Connection::send( string s )
{
assert( attached );
assert( has_remote_addr );
Packet px = new_packet( s );
@@ -252,7 +252,7 @@ string Connection::recv( void )
}
/* auto-adjust to remote host */
attached = true;
has_remote_addr = true;
if ( (remote_addr.sin_addr.s_addr != packet_remote_addr.sin_addr.s_addr)
|| (remote_addr.sin_port != packet_remote_addr.sin_port) ) {
+2 -2
View File
@@ -75,10 +75,10 @@ namespace Network {
static const uint64_t MAX_RTO = 1000; /* ms */
int sock;
bool has_remote_addr;
struct sockaddr_in remote_addr;
bool server;
bool attached;
int MTU;
@@ -110,7 +110,7 @@ namespace Network {
int port( void ) const;
string get_key( void ) const { return key.printable_key(); }
bool get_attached( void ) const { return attached; }
bool get_has_remote_addr( void ) const { return has_remote_addr; }
uint64_t timeout( void ) const;
double get_SRTT( void ) const { return SRTT; }
+1 -1
View File
@@ -73,7 +73,7 @@ namespace Network {
bool shutdown_in_progress( void ) const { return sender.get_shutdown_in_progress(); }
bool shutdown_acknowledged( void ) const { return sender.get_shutdown_acknowledged(); }
bool shutdown_ack_timed_out( void ) const { return sender.shutdown_ack_timed_out(); }
bool attached( void ) const { return connection.get_attached(); }
bool has_remote_addr( void ) const { return connection.get_has_remote_addr(); }
/* Other side has requested shutdown and we have sent one ACK */
bool counterparty_shutdown_ack_sent( void ) const { return sender.get_counterparty_shutdown_acknowledged(); }
+2 -2
View File
@@ -111,7 +111,7 @@ int TransportSender<MyState>::wait_time( void )
uint64_t now = timestamp();
if ( !connection->get_attached() ) {
if ( !connection->get_has_remote_addr() ) {
return -1;
}
@@ -128,7 +128,7 @@ void TransportSender<MyState>::tick( void )
{
calculate_timers(); /* updates assumed receiver state and rationalizes */
if ( !connection->get_attached() ) {
if ( !connection->get_has_remote_addr() ) {
return;
}