committed by
Keith Winstein
parent
fb6d07e566
commit
49fc21c8a3
@@ -124,13 +124,13 @@ int main( int argc, char *argv[] )
|
|||||||
}
|
}
|
||||||
|
|
||||||
client.shutdown();
|
client.shutdown();
|
||||||
} catch ( Network::NetworkException e ) {
|
} catch ( const Network::NetworkException& e ) {
|
||||||
fprintf( stderr, "Network exception: %s: %s\r\n",
|
fprintf( stderr, "Network exception: %s: %s\r\n",
|
||||||
e.function.c_str(), strerror( e.the_errno ) );
|
e.function.c_str(), strerror( e.the_errno ) );
|
||||||
} catch ( Crypto::CryptoException e ) {
|
} catch ( const Crypto::CryptoException& e ) {
|
||||||
fprintf( stderr, "Crypto exception: %s\r\n",
|
fprintf( stderr, "Crypto exception: %s\r\n",
|
||||||
e.text.c_str() );
|
e.text.c_str() );
|
||||||
} catch ( std::string s ) {
|
} catch ( const std::string& s ) {
|
||||||
fprintf( stderr, "Error: %s\r\n", s.c_str() );
|
fprintf( stderr, "Error: %s\r\n", s.c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -277,11 +277,11 @@ int main( int argc, char *argv[] )
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
return run_server( desired_ip, desired_port, command_path, command_argv, colors, verbose, with_motd );
|
return run_server( desired_ip, desired_port, command_path, command_argv, colors, verbose, with_motd );
|
||||||
} catch ( Network::NetworkException e ) {
|
} catch ( const Network::NetworkException& e ) {
|
||||||
fprintf( stderr, "Network exception: %s: %s\n",
|
fprintf( stderr, "Network exception: %s: %s\n",
|
||||||
e.function.c_str(), strerror( e.the_errno ) );
|
e.function.c_str(), strerror( e.the_errno ) );
|
||||||
return 1;
|
return 1;
|
||||||
} catch ( Crypto::CryptoException e ) {
|
} catch ( const Crypto::CryptoException& e ) {
|
||||||
fprintf( stderr, "Crypto exception: %s\n",
|
fprintf( stderr, "Crypto exception: %s\n",
|
||||||
e.text.c_str() );
|
e.text.c_str() );
|
||||||
return 1;
|
return 1;
|
||||||
@@ -436,10 +436,10 @@ int run_server( const char *desired_ip, const char *desired_port,
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
serve( master, terminal, *network );
|
serve( master, terminal, *network );
|
||||||
} catch ( Network::NetworkException e ) {
|
} catch ( const Network::NetworkException& e ) {
|
||||||
fprintf( stderr, "Network exception: %s: %s\n",
|
fprintf( stderr, "Network exception: %s: %s\n",
|
||||||
e.function.c_str(), strerror( e.the_errno ) );
|
e.function.c_str(), strerror( e.the_errno ) );
|
||||||
} catch ( Crypto::CryptoException e ) {
|
} catch ( const Crypto::CryptoException& e ) {
|
||||||
fprintf( stderr, "Crypto exception: %s\n",
|
fprintf( stderr, "Crypto exception: %s\n",
|
||||||
e.text.c_str() );
|
e.text.c_str() );
|
||||||
}
|
}
|
||||||
@@ -689,10 +689,10 @@ void serve( int host_fd, Terminal::Complete &terminal, ServerConnection &network
|
|||||||
}
|
}
|
||||||
|
|
||||||
network.tick();
|
network.tick();
|
||||||
} catch ( Network::NetworkException e ) {
|
} catch ( const Network::NetworkException& e ) {
|
||||||
fprintf( stderr, "%s: %s\n", e.function.c_str(), strerror( e.the_errno ) );
|
fprintf( stderr, "%s: %s\n", e.function.c_str(), strerror( e.the_errno ) );
|
||||||
spin();
|
spin();
|
||||||
} catch ( Crypto::CryptoException e ) {
|
} catch ( const Crypto::CryptoException& e ) {
|
||||||
if ( e.fatal ) {
|
if ( e.fatal ) {
|
||||||
throw;
|
throw;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ Connection::Connection( const char *desired_ip, const char *desired_port ) /* se
|
|||||||
if ( desired_ip_addr != INADDR_ANY ) {
|
if ( desired_ip_addr != INADDR_ANY ) {
|
||||||
try {
|
try {
|
||||||
if ( try_bind( sock, desired_ip_addr, desired_port_no ) ) { return; }
|
if ( try_bind( sock, desired_ip_addr, desired_port_no ) ) { return; }
|
||||||
} catch ( NetworkException e ) {
|
} catch ( const NetworkException& e ) {
|
||||||
struct in_addr sin_addr;
|
struct in_addr sin_addr;
|
||||||
sin_addr.s_addr = desired_ip_addr;
|
sin_addr.s_addr = desired_ip_addr;
|
||||||
fprintf( stderr, "Error binding to IP %s: %s: %s\n",
|
fprintf( stderr, "Error binding to IP %s: %s: %s\n",
|
||||||
@@ -184,7 +184,7 @@ Connection::Connection( const char *desired_ip, const char *desired_port ) /* se
|
|||||||
/* now try any local interface */
|
/* now try any local interface */
|
||||||
try {
|
try {
|
||||||
if ( try_bind( sock, INADDR_ANY, desired_port_no ) ) { return; }
|
if ( try_bind( sock, INADDR_ANY, desired_port_no ) ) { return; }
|
||||||
} catch ( NetworkException e ) {
|
} catch ( const NetworkException& e ) {
|
||||||
fprintf( stderr, "Error binding to any interface: %s: %s\n",
|
fprintf( stderr, "Error binding to any interface: %s: %s\n",
|
||||||
e.function.c_str(), strerror( e.the_errno ) );
|
e.function.c_str(), strerror( e.the_errno ) );
|
||||||
throw; /* this time it's fatal */
|
throw; /* this time it's fatal */
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ void test_bad_decrypt( Session &decryption_session ) {
|
|||||||
bool got_exn = false;
|
bool got_exn = false;
|
||||||
try {
|
try {
|
||||||
decryption_session.decrypt( bad_ct );
|
decryption_session.decrypt( bad_ct );
|
||||||
} catch ( CryptoException e ) {
|
} catch ( const CryptoException& e ) {
|
||||||
got_exn = true;
|
got_exn = true;
|
||||||
|
|
||||||
/* The "bad decrypt" exception needs to be non-fatal, otherwise we are
|
/* The "bad decrypt" exception needs to be non-fatal, otherwise we are
|
||||||
@@ -128,7 +128,7 @@ int main( int argc, char *argv[] ) {
|
|||||||
for ( size_t i=0; i<NUM_SESSIONS; i++ ) {
|
for ( size_t i=0; i<NUM_SESSIONS; i++ ) {
|
||||||
try {
|
try {
|
||||||
test_one_session();
|
test_one_session();
|
||||||
} catch ( CryptoException e ) {
|
} catch ( const CryptoException& e ) {
|
||||||
fprintf( stderr, "Crypto exception: %s\r\n",
|
fprintf( stderr, "Crypto exception: %s\r\n",
|
||||||
e.text.c_str() );
|
e.text.c_str() );
|
||||||
fatal_assert( false );
|
fatal_assert( false );
|
||||||
|
|||||||
Reference in New Issue
Block a user