From 7b3b47aa391056d94b8c6c09096f106016b87a27 Mon Sep 17 00:00:00 2001 From: Scott Fennell Date: Mon, 1 Oct 2018 10:26:17 -0500 Subject: [PATCH] init value and style change VariableServerListenThread.cpp --- .../VariableServerListenThread.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/trick_source/sim_services/VariableServer/VariableServerListenThread.cpp b/trick_source/sim_services/VariableServer/VariableServerListenThread.cpp index ed4fd5c3..06d25df1 100644 --- a/trick_source/sim_services/VariableServer/VariableServerListenThread.cpp +++ b/trick_source/sim_services/VariableServer/VariableServerListenThread.cpp @@ -116,7 +116,7 @@ void * Trick::VariableServerListenThread::thread_body() { std::string version; char * user_name ; - int mcast_socket ; + int mcast_socket = 0; struct sockaddr_in mcast_addr ; struct sockaddr_in mcast_addr_legacy ; @@ -177,17 +177,14 @@ void * Trick::VariableServerListenThread::thread_body() { vst->create_thread() ; vst->wait_for_accept() ; pthread_mutex_unlock(&restart_pause) ; - } else { - if ( broadcast ) { - sprintf(buf1 , "%s\t%hu\t%s\t%d\t%s\t%s\t%s\t%s\t%s\t%hu\n" , listen_dev.hostname , (unsigned short)listen_dev.port , - user_name , (int)getpid() , command_line_args_get_default_dir() , command_line_args_get_cmdline_name() , - command_line_args_get_input_file() , version.c_str() , user_tag.c_str(), (unsigned short)listen_dev.port ) ; + } else if ( broadcast ) { + sprintf(buf1 , "%s\t%hu\t%s\t%d\t%s\t%s\t%s\t%s\t%s\t%hu\n" , listen_dev.hostname , (unsigned short)listen_dev.port , + user_name , (int)getpid() , command_line_args_get_default_dir() , command_line_args_get_cmdline_name() , + command_line_args_get_input_file() , version.c_str() , user_tag.c_str(), (unsigned short)listen_dev.port ) ; - sendto(mcast_socket , buf1 , strlen(buf1) , 0 , (struct sockaddr *)&mcast_addr , (socklen_t)sizeof(mcast_addr)) ; - sendto(mcast_socket , buf1 , strlen(buf1) , 0 , (struct sockaddr *)&mcast_addr_legacy , (socklen_t)sizeof(mcast_addr)) ; - } + sendto(mcast_socket , buf1 , strlen(buf1) , 0 , (struct sockaddr *)&mcast_addr , (socklen_t)sizeof(mcast_addr)) ; + sendto(mcast_socket , buf1 , strlen(buf1) , 0 , (struct sockaddr *)&mcast_addr_legacy , (socklen_t)sizeof(mcast_addr)) ; } - } return NULL ;