summaryrefslogtreecommitdiff
path: root/anytun.cpp
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2008-02-06 19:11:45 +0000
committerChristian Pointner <equinox@anytun.org>2008-02-06 19:11:45 +0000
commit729b6da8a74a6ddba6539f641e4faf8d6de44d16 (patch)
tree16c4a835cd4b481e0d36701ff82ee7d3327a3b32 /anytun.cpp
parentupdated example pcap filupdated example pcap file (diff)
added wireshakr lua script for satp
Diffstat (limited to 'anytun.cpp')
-rw-r--r--anytun.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/anytun.cpp b/anytun.cpp
index dafc7bf..a55145e 100644
--- a/anytun.cpp
+++ b/anytun.cpp
@@ -90,7 +90,6 @@ void createConnection(const std::string & remote_host , u_int16_t remote_port, C
ConnectionParam connparam ( (*kd), (*seq), seq_nr_, remote_host, remote_port);
cl.addConnection(connparam,0);
SyncCommand sc (cl,0);
-
queue.push(sc);
}
@@ -294,16 +293,19 @@ void* receiver(void* p)
void initLibGCrypt()
{
+ // make libgcrypt thread safe
+ gcry_control( GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread );
+
gcry_error_t err;
// No other library has already initialized libgcrypt.
if( !gcry_control(GCRYCTL_ANY_INITIALIZATION_P) )
{
if( !gcry_check_version( MIN_GCRYPT_VERSION ) ) {
- cLog.msg(Log::PRIO_ERR) << "KeyDerivation::init: Invalid Version of libgcrypt, should be >= " << MIN_GCRYPT_VERSION;
+ cLog.msg(Log::PRIO_ERR) << "initLibGCrypt: Invalid Version of libgcrypt, should be >= " << MIN_GCRYPT_VERSION;
return;
}
- // do NOT allocate a pool of secure memory!
+ // do NOT allocate a pool of secure memory!
// this is NOT thread safe!
/* Allocate a pool of 16k secure memory. This also drops priviliges
@@ -318,10 +320,10 @@ void initLibGCrypt()
/* Tell Libgcrypt that initialization has completed. */
err = gcry_control(GCRYCTL_INITIALIZATION_FINISHED);
if( err ) {
- cLog.msg(Log::PRIO_ERR) << "KeyDerivation::init: Failed to finish the initialization of libgcrypt: " << gpg_strerror( err );
+ cLog.msg(Log::PRIO_ERR) << "initLibGCrypt: Failed to finish the initialization of libgcrypt: " << gpg_strerror( err );
return;
} else {
- cLog.msg(Log::PRIO_NOTICE) << "KeyDerivation::init: libgcrypt init finished";
+ cLog.msg(Log::PRIO_NOTICE) << "initLibGCrypt: libgcrypt init finished";
}
}
}
@@ -367,8 +369,6 @@ int main(int argc, char* argv[])
cLog.msg(Log::PRIO_NOTICE) << "dev opened - actual name is '" << p.dev.getActualName() << "'";
cLog.msg(Log::PRIO_NOTICE) << "dev type is '" << p.dev.getTypeString() << "'";
- // make libgcrypt thread safe
- gcry_control( GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread );
initLibGCrypt();
pthread_t senderThread;
@@ -396,7 +396,7 @@ int main(int argc, char* argv[])
pthread_cancel(syncListenerThread);
for( std::list<pthread_t>::iterator it = connectThreads.begin() ;it != connectThreads.end(); ++it)
pthread_cancel(*it);
-
+
pthread_join(senderThread, NULL);
pthread_join(receiverThread, NULL);
if ( opt.getLocalSyncPort())