Do not throw from destructors, fatal_assert() instead.

This commit is contained in:
John Hood
2016-02-24 20:29:41 -05:00
parent 49a4106ae4
commit c964d40dd8
2 changed files with 3 additions and 6 deletions
+2 -3
View File
@@ -41,6 +41,7 @@
#include "byteorder.h" #include "byteorder.h"
#include "crypto.h" #include "crypto.h"
#include "base64.h" #include "base64.h"
#include "fatal_assert.h"
#include "prng.h" #include "prng.h"
using namespace std; using namespace std;
@@ -171,9 +172,7 @@ Session::Session( Base64Key s_key )
Session::~Session() Session::~Session()
{ {
if ( ae_clear( ctx ) != AE_SUCCESS ) { fatal_assert( ae_clear( ctx ) == AE_SUCCESS );
throw CryptoException( "Could not clear AES-OCB context." );
}
} }
Nonce::Nonce( uint64_t val ) Nonce::Nonce( uint64_t val )
+1 -3
View File
@@ -639,9 +639,7 @@ uint64_t Connection::timeout( void ) const
Connection::Socket::~Socket() Connection::Socket::~Socket()
{ {
if ( close( _fd ) < 0 ) { fatal_assert ( close( _fd ) == 0 );
throw NetworkException( "close", errno );
}
} }
Connection::Socket::Socket( const Socket & other ) Connection::Socket::Socket( const Socket & other )