summaryrefslogtreecommitdiff
path: root/anytun.cpp
diff options
context:
space:
mode:
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;