mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-20 02:40:03 +02:00
removed exit() in most places.. should just return EXIT_SUCCESS or failure instead of exiting, which was why the unique pointer needed a release (in this case, we removed pointer for consistency)
Some checks failed
CMake / Configure and build using cmake (push) Failing after 8s
Some checks failed
CMake / Configure and build using cmake (push) Failing after 8s
This commit is contained in:
parent
ec3cfc1138
commit
9d0ae22981
@ -152,12 +152,12 @@ int main(int argc, char *argv[]) {
|
|||||||
strcpy(version, APIXILINXCTB);
|
strcpy(version, APIXILINXCTB);
|
||||||
#endif
|
#endif
|
||||||
LOG(logINFO, ("SLS Detector Server Version: %s\n", version));
|
LOG(logINFO, ("SLS Detector Server Version: %s\n", version));
|
||||||
exit(EXIT_SUCCESS);
|
return EXIT_SUCCESS;
|
||||||
|
|
||||||
case 'p':
|
case 'p':
|
||||||
if (sscanf(optarg, "%d", &portno) != 1) {
|
if (sscanf(optarg, "%d", &portno) != 1) {
|
||||||
LOG(logERROR, ("Cannot scan port argument\n%s", helpMessage));
|
LOG(logERROR, ("Cannot scan port argument\n%s", helpMessage));
|
||||||
exit(EXIT_FAILURE);
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("Detected port: %d\n", portno));
|
LOG(logINFO, ("Detected port: %d\n", portno));
|
||||||
break;
|
break;
|
||||||
@ -188,7 +188,7 @@ int main(int argc, char *argv[]) {
|
|||||||
ignoreConfigFileFlag = 1;
|
ignoreConfigFileFlag = 1;
|
||||||
#else
|
#else
|
||||||
LOG(logERROR, ("No server config files for this detector\n"));
|
LOG(logERROR, ("No server config files for this detector\n"));
|
||||||
exit(EXIT_FAILURE);
|
return EXIT_FAILURE;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -196,11 +196,11 @@ int main(int argc, char *argv[]) {
|
|||||||
#if !defined(VIRTUAL) && !defined(EIGERD)
|
#if !defined(VIRTUAL) && !defined(EIGERD)
|
||||||
LOG(logERROR, ("Cannot set master via the detector server for this "
|
LOG(logERROR, ("Cannot set master via the detector server for this "
|
||||||
"detector\n"));
|
"detector\n"));
|
||||||
exit(EXIT_FAILURE);
|
return EXIT_FAILURE;
|
||||||
#elif defined(GOTTHARD2D) || defined(EIGERD) || defined(MYTHEN3D)
|
#elif defined(GOTTHARD2D) || defined(EIGERD) || defined(MYTHEN3D)
|
||||||
if (sscanf(optarg, "%d", &masterCommandLine) != 1) {
|
if (sscanf(optarg, "%d", &masterCommandLine) != 1) {
|
||||||
LOG(logERROR, ("Cannot scan master argument\n%s", helpMessage));
|
LOG(logERROR, ("Cannot scan master argument\n%s", helpMessage));
|
||||||
exit(EXIT_FAILURE);
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
if (masterCommandLine == 1) {
|
if (masterCommandLine == 1) {
|
||||||
LOG(logINFO, ("Detector Master mode\n"));
|
LOG(logINFO, ("Detector Master mode\n"));
|
||||||
@ -209,7 +209,7 @@ int main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
LOG(logERROR, ("No master implemented for this detector server\n"));
|
LOG(logERROR, ("No master implemented for this detector server\n"));
|
||||||
exit(EXIT_FAILURE);
|
return EXIT_FAILURE;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -217,7 +217,7 @@ int main(int argc, char *argv[]) {
|
|||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
if (sscanf(optarg, "%d", &topCommandLine) != 1) {
|
if (sscanf(optarg, "%d", &topCommandLine) != 1) {
|
||||||
LOG(logERROR, ("Cannot scan top argument\n%s", helpMessage));
|
LOG(logERROR, ("Cannot scan top argument\n%s", helpMessage));
|
||||||
exit(EXIT_FAILURE);
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
if (topCommandLine == 1) {
|
if (topCommandLine == 1) {
|
||||||
LOG(logINFO, ("Detector Top mode\n"));
|
LOG(logINFO, ("Detector Top mode\n"));
|
||||||
@ -226,16 +226,16 @@ int main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
LOG(logERROR, ("No top implemented for this detector server\n"));
|
LOG(logERROR, ("No top implemented for this detector server\n"));
|
||||||
exit(EXIT_FAILURE);
|
return EXIT_FAILURE;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
printf("%s", helpMessage);
|
printf("%s", helpMessage);
|
||||||
exit(EXIT_SUCCESS);
|
return EXIT_SUCCESS;
|
||||||
default:
|
default:
|
||||||
printf("\n%s", helpMessage);
|
printf("\n%s", helpMessage);
|
||||||
exit(EXIT_FAILURE);
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,5 +376,5 @@ int main(int argc, char *argv[]) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("Goodbye!\n"));
|
LOG(logINFO, ("Goodbye!\n"));
|
||||||
return 0;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ int main(int argc, char *argv[]) {
|
|||||||
c.call(parser.command(), parser.arguments(), parser.detector_id(),
|
c.call(parser.command(), parser.arguments(), parser.detector_id(),
|
||||||
action, std::cout, parser.receiver_id());
|
action, std::cout, parser.receiver_id());
|
||||||
} catch (sls::RuntimeError &e) {
|
} catch (sls::RuntimeError &e) {
|
||||||
exit(EXIT_FAILURE);
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
exit(EXIT_SUCCESS);
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
@ -527,7 +527,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
case 'v':
|
case 'v':
|
||||||
std::cout << argv[0] << " Version: " << APIRECEIVER << std::endl;
|
std::cout << argv[0] << " Version: " << APIRECEIVER << std::endl;
|
||||||
exit(EXIT_SUCCESS);
|
return (EXIT_SUCCESS);
|
||||||
|
|
||||||
case 'n':
|
case 'n':
|
||||||
try {
|
try {
|
||||||
@ -564,17 +564,17 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
std::cout << help_message << std::endl;
|
std::cout << help_message << std::endl;
|
||||||
exit(EXIT_SUCCESS);
|
return (EXIT_SUCCESS);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
LOG(sls::logERROR) << help_message;
|
LOG(sls::logERROR) << help_message;
|
||||||
exit(EXIT_FAILURE);
|
return (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// remaining arguments
|
// remaining arguments
|
||||||
if (optind < argc) {
|
if (optind < argc) {
|
||||||
LOG(sls::logERROR) << "Invalid arguments\n" << help_message;
|
LOG(sls::logERROR) << "Invalid arguments\n" << help_message;
|
||||||
exit(EXIT_FAILURE);
|
return (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(sls::logINFOBLUE) << "Current Process [ Tid: " << gettid() << ']';
|
LOG(sls::logINFOBLUE) << "Current Process [ Tid: " << gettid() << ']';
|
||||||
|
@ -139,10 +139,9 @@ void GetData(slsDetectorDefs::sls_receiver_header &header,
|
|||||||
*/
|
*/
|
||||||
void sigInterruptHandler(int p) { sem_post(&semaphore); }
|
void sigInterruptHandler(int p) { sem_post(&semaphore); }
|
||||||
|
|
||||||
void GetDeprecatedCommandLineOptions(int argc, char *argv[],
|
int GetDeprecatedCommandLineOptions(int argc, char *argv[], uint16_t &startPort,
|
||||||
uint16_t &startPort,
|
uint16_t &numReceivers,
|
||||||
uint16_t &numReceivers,
|
bool &callbackEnabled) {
|
||||||
bool &callbackEnabled) {
|
|
||||||
std::string deprecatedMessage =
|
std::string deprecatedMessage =
|
||||||
"Detected deprecated Options. Please update.\n";
|
"Detected deprecated Options. Please update.\n";
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
@ -154,12 +153,12 @@ void GetDeprecatedCommandLineOptions(int argc, char *argv[],
|
|||||||
LOG(sls::logWARNING) << deprecatedMessage;
|
LOG(sls::logWARNING) << deprecatedMessage;
|
||||||
LOG(sls::logERROR)
|
LOG(sls::logERROR)
|
||||||
<< "Did you mix up the order of the arguments?";
|
<< "Did you mix up the order of the arguments?";
|
||||||
exit(EXIT_FAILURE);
|
return slsDetectorDefs::FAIL;
|
||||||
}
|
}
|
||||||
if (numReceivers == 0) {
|
if (numReceivers == 0) {
|
||||||
LOG(sls::logWARNING) << deprecatedMessage;
|
LOG(sls::logWARNING) << deprecatedMessage;
|
||||||
LOG(sls::logERROR) << "Invalid number of receivers.";
|
LOG(sls::logERROR) << "Invalid number of receivers.";
|
||||||
exit(EXIT_FAILURE);
|
return slsDetectorDefs::FAIL;
|
||||||
}
|
}
|
||||||
if (argc == 4) {
|
if (argc == 4) {
|
||||||
callbackEnabled = sls::StringTo<bool>(argv[3]);
|
callbackEnabled = sls::StringTo<bool>(argv[3]);
|
||||||
@ -169,9 +168,10 @@ void GetDeprecatedCommandLineOptions(int argc, char *argv[],
|
|||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
LOG(sls::logWARNING) << deprecatedMessage;
|
LOG(sls::logWARNING) << deprecatedMessage;
|
||||||
LOG(sls::logERROR) << e.what();
|
LOG(sls::logERROR) << e.what();
|
||||||
exit(EXIT_FAILURE);
|
return slsDetectorDefs::FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return slsDetectorDefs::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getHelpMessage() {
|
std::string getHelpMessage() {
|
||||||
@ -221,7 +221,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
case 'v':
|
case 'v':
|
||||||
std::cout << argv[0] << " Version: " << APIRECEIVER << std::endl;
|
std::cout << argv[0] << " Version: " << APIRECEIVER << std::endl;
|
||||||
exit(EXIT_SUCCESS);
|
return EXIT_SUCCESS;
|
||||||
|
|
||||||
case 'n':
|
case 'n':
|
||||||
try {
|
try {
|
||||||
@ -262,18 +262,20 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
std::cout << help_message << std::endl;
|
std::cout << help_message << std::endl;
|
||||||
exit(EXIT_SUCCESS);
|
return EXIT_SUCCESS;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
LOG(sls::logERROR) << help_message;
|
LOG(sls::logERROR) << help_message;
|
||||||
exit(EXIT_FAILURE);
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if remaining arguments, maintain backward compatibility of [startport]
|
// if remaining arguments, maintain backward compatibility of [startport]
|
||||||
// [num-receivers] [callback]
|
// [num-receivers] [callback]
|
||||||
if (optind < argc) {
|
if (optind < argc) {
|
||||||
GetDeprecatedCommandLineOptions(argc, argv, startPort, numReceivers,
|
if (slsDetectorDefs::FAIL ==
|
||||||
callbackEnabled);
|
GetDeprecatedCommandLineOptions(argc, argv, startPort, numReceivers,
|
||||||
|
callbackEnabled))
|
||||||
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(sls::logINFOBLUE) << "Current Process [ Tid: " << gettid() << ']';
|
LOG(sls::logINFOBLUE) << "Current Process [ Tid: " << gettid() << ']';
|
||||||
@ -381,7 +383,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
LOG(sls::logINFOBLUE)
|
LOG(sls::logINFOBLUE)
|
||||||
<< "Exiting Child Process [ Tid: " << gettid() << ']';
|
<< "Exiting Child Process [ Tid: " << gettid() << ']';
|
||||||
exit(EXIT_SUCCESS);
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -422,5 +424,5 @@ int main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "Goodbye!\n";
|
std::cout << "Goodbye!\n";
|
||||||
return 0;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
case 'v':
|
case 'v':
|
||||||
std::cout << argv[0] << " Version: " << APIRECEIVER << std::endl;
|
std::cout << argv[0] << " Version: " << APIRECEIVER << std::endl;
|
||||||
exit(EXIT_SUCCESS);
|
return (EXIT_SUCCESS);
|
||||||
|
|
||||||
case 't':
|
case 't':
|
||||||
LOG(sls::logWARNING)
|
LOG(sls::logWARNING)
|
||||||
@ -78,17 +78,17 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
std::cout << help_message << std::endl;
|
std::cout << help_message << std::endl;
|
||||||
exit(EXIT_SUCCESS);
|
return (EXIT_SUCCESS);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
LOG(sls::logERROR) << help_message;
|
LOG(sls::logERROR) << help_message;
|
||||||
exit(EXIT_FAILURE);
|
return (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// remaining arguments
|
// remaining arguments
|
||||||
if (optind < argc) {
|
if (optind < argc) {
|
||||||
LOG(sls::logERROR) << "Invalid arguments\n" << help_message;
|
LOG(sls::logERROR) << "Invalid arguments\n" << help_message;
|
||||||
exit(EXIT_FAILURE);
|
return (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(sls::logINFOBLUE) << "Current Process [ Tid: " << gettid() << " ]";
|
LOG(sls::logINFOBLUE) << "Current Process [ Tid: " << gettid() << " ]";
|
||||||
@ -147,5 +147,5 @@ int main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
LOG(sls::logINFOBLUE) << "Exiting [ Tid: " << gettid() << " ]";
|
LOG(sls::logINFOBLUE) << "Exiting [ Tid: " << gettid() << " ]";
|
||||||
LOG(sls::logINFO) << "Exiting Receiver";
|
LOG(sls::logINFO) << "Exiting Receiver";
|
||||||
return 0;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user