diff options
author | lloyd <[email protected]> | 2006-06-25 15:23:19 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-06-25 15:23:19 +0000 |
commit | 7a259add43ce9ad6ea30fcbb77ac7bca932db211 (patch) | |
tree | c1d4857694ddd3bc4709c54337cd8fa76669e6c5 /modules/eng_aep | |
parent | a495fd2e01430a74833d667b6fec0a2cc4b23be5 (diff) |
Support named mutexes outside of the global library state.
Alter the AEP engine to use one in favor of a static Mutex pointer.
Fix a stupid typo in an exception message.
Diffstat (limited to 'modules/eng_aep')
-rw-r--r-- | modules/eng_aep/aep_conn.cpp | 17 | ||||
-rw-r--r-- | modules/eng_aep/aep_conn.h | 1 |
2 files changed, 6 insertions, 12 deletions
diff --git a/modules/eng_aep/aep_conn.cpp b/modules/eng_aep/aep_conn.cpp index 9293f45fc..6175bc5ae 100644 --- a/modules/eng_aep/aep_conn.cpp +++ b/modules/eng_aep/aep_conn.cpp @@ -14,20 +14,19 @@ namespace Botan { * Persistent connection pool * *************************************************/ std::vector<AEP_Connection::Connection_Info> AEP_Connection::pool; -Mutex* AEP_Connection::guard = 0; /************************************************* * Close all currently open connections * *************************************************/ void AEP_Connection::close_all_connections() { - guard->lock(); + Mutex* mutex = global_state().get_named_mutex("aep"); + + mutex->lock(); for(u32bit j = 0; j != pool.size(); j++) AEP::AEP_CloseConnection(pool[j].id); pool.clear(); - guard->unlock(); - delete guard; - guard = 0; + mutex->unlock(); } /************************************************* @@ -35,11 +34,7 @@ void AEP_Connection::close_all_connections() *************************************************/ AEP_Connection::AEP_Connection() { - // FIXME: race condition - if(!guard) - guard = global_state().get_mutex(); - - Mutex_Holder lock(guard); + Named_Mutex_Holder lock("aep"); this_connection = 0; @@ -73,7 +68,7 @@ AEP_Connection::AEP_Connection() *************************************************/ AEP_Connection::~AEP_Connection() { - Mutex_Holder lock(guard); + Named_Mutex_Holder lock("aep"); for(u32bit j = 0; j != pool.size(); j++) { diff --git a/modules/eng_aep/aep_conn.h b/modules/eng_aep/aep_conn.h index 18b8c76db..9b1d97e58 100644 --- a/modules/eng_aep/aep_conn.h +++ b/modules/eng_aep/aep_conn.h @@ -28,7 +28,6 @@ class AEP_Connection static const u32bit MAX_CACHED_CONNECTIONS = 8; static std::vector<Connection_Info> pool; - static Mutex* guard; u32bit this_connection; }; |