Commit 30445a6a authored by Matteo Quintiliani's avatar Matteo Quintiliani

Fixed bug: check if we are already listening on port before launching thread


git-svn-id: file:///home/quintiliani/svncopy/nmxptool/trunk@1074 3cd66e75-5955-46cb-a940-c26e5fc5497d
parent 98c2ef4b
......@@ -7,7 +7,7 @@
* Istituto Nazionale di Geofisica e Vulcanologia - Italy
* quintiliani@ingv.it
*
* $Id: nmxptool.c,v 1.194 2008-04-22 13:37:50 mtheo Exp $
* $Id: nmxptool.c,v 1.195 2008-04-24 08:08:24 mtheo Exp $
*
*/
......@@ -87,6 +87,7 @@ void *p_nmxp_sendAddTimeSeriesChannel(void *arg);
pthread_t thread_socket_listen;
pthread_attr_t attr_socket_listen;
void *status_thread_socket_listen;
int already_listen = 0;
#endif
......@@ -785,7 +786,8 @@ int main (int argc, char **argv) {
#endif
#ifdef HAVE_PTHREAD_H
if(params.listen_port != DEFAULT_LISTEN_PORT) {
if(!already_listen && params.listen_port != DEFAULT_LISTEN_PORT) {
already_listen = 1;
pthread_attr_init(&attr_socket_listen);
pthread_attr_setdetachstate(&attr_socket_listen, PTHREAD_CREATE_DETACHED);
pthread_create(&thread_socket_listen, &attr_socket_listen, nmxptool_listen, (void *)params.listen_port);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment