diff options
author | Erwin Nindl <nine@wirdorange.org> | 2008-02-28 20:52:02 +0000 |
---|---|---|
committer | Erwin Nindl <nine@wirdorange.org> | 2008-02-28 20:52:02 +0000 |
commit | 24cafee6154b7e4e3b206f8a88fa08ffca11b2b1 (patch) | |
tree | d8841d8650d0a25e5c01af85b2dbc1681b5ab660 /anymux.cpp | |
parent | sync bugfix (diff) |
added file parameter to anymux
modified makefile
Diffstat (limited to 'anymux.cpp')
-rw-r--r-- | anymux.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
@@ -31,27 +31,32 @@ #include <iostream> #include <poll.h> -#include <cerrno> // for ENOMEM - #include "datatypes.h" #include "log.h" #include "signalController.h" -#include "options.h" +#include "anymuxOptions.h" #include "muxSocket.h" #include "Sockets/ListenSocket.h" #include "Sockets/SocketHandler.h" -void* syncListener(void* p ) +class ThreadParam { - //ThreadParam* param = reinterpret_cast<ThreadParam*>(p); +public: + ThreadParam() : port(0) {}; + u_int16_t port; +}; + +void* syncListener(void* p ) +{ + ThreadParam* param = reinterpret_cast<ThreadParam*>(p); SOCKETS_NAMESPACE::SocketHandler h; SOCKETS_NAMESPACE::ListenSocket<MuxSocket> l(h,true); - if (l.Bind(1234)) + if( l.Bind(param->port) ) pthread_exit(NULL); Utility::ResolveLocal(); // resolve local hostname @@ -72,10 +77,10 @@ int main(int argc, char* argv[]) SignalController sig; sig.init(); -// ThreadParam p(4445); - int port; + ThreadParam p; + p.port = gOpt.getLocalPort(); pthread_t syncListenerThread; - pthread_create(&syncListenerThread, NULL, syncListener, &port); + pthread_create(&syncListenerThread, NULL, syncListener, &p); int ret = sig.run(); |