summaryrefslogtreecommitdiff
path: root/src/anytun.cpp
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2009-01-15 02:20:05 +0000
committerChristian Pointner <equinox@anytun.org>2009-01-15 02:20:05 +0000
commit6c359a35146d9b728fab8c8d8220aa340abfd89d (patch)
tree4cea9381f27f0933d18d6c1ed63b507b747a9bd5 /src/anytun.cpp
parentremoved useless file (diff)
small cleanup
Diffstat (limited to 'src/anytun.cpp')
-rw-r--r--src/anytun.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/anytun.cpp b/src/anytun.cpp
index 3949187..bbea08a 100644
--- a/src/anytun.cpp
+++ b/src/anytun.cpp
@@ -79,13 +79,13 @@
void createConnection(const PacketSourceEndpoint & remote_end, window_size_t seqSize, mux_t mux)
{
- SeqWindow * seq= new SeqWindow(seqSize);
+ SeqWindow* seq = new SeqWindow(seqSize);
seq_nr_t seq_nr_=0;
KeyDerivation * kd = KeyDerivationFactory::create(gOpt.getKdPrf());
kd->init(gOpt.getKey(), gOpt.getSalt());
cLog.msg(Log::PRIO_NOTICE) << "added connection remote host " << remote_end;
- ConnectionParam connparam ( (*kd), (*seq), seq_nr_, remote_end);
+ ConnectionParam connparam ((*kd), (*seq), seq_nr_, remote_end);
gConnectionList.addConnection(connparam,mux);
#ifndef ANYTUN_NOSYNC
SyncCommand sc (gConnectionList,mux);
@@ -411,8 +411,9 @@ int main(int argc, char* argv[])
SignalController sig;
sig.init();
#endif
-
- ThreadParam p(dev, *src, *(new OptionConnectTo()));
+
+ OptionConnectTo* connTo = new OptionConnectTo();
+ ThreadParam p(dev, *src, *connTo);
#ifndef NOCRYPT
#ifndef USE_SSL_CRYPTO
@@ -440,11 +441,10 @@ int main(int argc, char* argv[])
#ifndef NOSIGNALCONTROLLER
int ret = sig.run();
- return ret;
#else
- receiver(&p);
+ receiver(&p);
#endif
- // TODO cleanup here!
+ // TODO cleanup threads here!
/*
pthread_cancel(senderThread);
pthread_cancel(receiverThread);
@@ -464,11 +464,13 @@ int main(int argc, char* argv[])
for( std::list<pthread_t>::iterator it = connectThreads.begin() ;it != connectThreads.end(); ++it)
pthread_join(*it, NULL);
#endif
- delete src;
- delete &p.connto;
-
- return ret;
+ if(src)
+ delete src;
+ if(connTo)
+ delete connTo;
*/
+
+ return ret;
}
catch(std::runtime_error& e)
{