summaryrefslogtreecommitdiff
path: root/anytun.cpp
diff options
context:
space:
mode:
authorOthmar Gsenger <otti@anytun.org>2007-12-12 14:20:48 +0000
committerOthmar Gsenger <otti@anytun.org>2007-12-12 14:20:48 +0000
commit19c6474a13c18a05edba262d5a4a255d425b64c6 (patch)
treef606b97c00a7f91e3703fd526ff77eb2d2534faf /anytun.cpp
parentchanged Mpi::getBuf, now returns u_int8_t *! (diff)
syncing only when sync port is specified
Diffstat (limited to 'anytun.cpp')
-rw-r--r--anytun.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/anytun.cpp b/anytun.cpp
index 3ba5de9..081f009 100644
--- a/anytun.cpp
+++ b/anytun.cpp
@@ -223,10 +223,8 @@ void* syncReceiver(void* p )
SOCKETS_NAMESPACE::SocketHandler h;
SyncListenSocket<SyncSocket,ConnectionList> l(h,param->cl);
- if (l.Bind(23))
- {
- exit(-1);
- }
+ if (l.Bind(param->opt.getLocalSyncPort()))
+ return(NULL);
Utility::ResolveLocal(); // resolve local hostname
h.Add(&l);
h.Select(1,0);
@@ -342,17 +340,20 @@ int main(int argc, char* argv[])
pthread_create(&senderThread, NULL, sender, &p);
pthread_t receiverThread;
pthread_create(&receiverThread, NULL, receiver, &p);
- pthread_t syncReceiverThread;
- pthread_create(&syncReceiverThread, NULL, syncReceiver, &p);
+ pthread_t syncReceiverThread;
+ if ( opt.getLocalSyncPort())
+ pthread_create(&syncReceiverThread, NULL, syncReceiver, &p);
int ret = sig.run();
pthread_cancel(senderThread);
pthread_cancel(receiverThread);
- pthread_cancel(syncReceiverThread);
+ if ( opt.getLocalSyncPort())
+ pthread_cancel(syncReceiverThread);
pthread_join(senderThread, NULL);
pthread_join(receiverThread, NULL);
- pthread_join(syncReceiverThread, NULL);
+ if ( opt.getLocalSyncPort())
+ pthread_join(syncReceiverThread, NULL);
delete src;