mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-01 00:51:18 +01:00
fixed validation in network_utils, added a tests to throw for port 65535 in test mode (option on for sls_use_tests), multi:parent process checks child process exit status to send sigint to others
This commit is contained in:
@@ -205,17 +205,16 @@ MacAddr InterfaceNameToMac(const std::string &inf) {
|
||||
}
|
||||
|
||||
void validatePortNumber(uint16_t port) {
|
||||
// random local port. might work if internal = bad practise
|
||||
if (port == 0) {
|
||||
throw RuntimeError("Invalid port number. Must be between 1 - 65535.");
|
||||
if (port < 1024 || port > std::numeric_limits<uint16_t>::max()) {
|
||||
throw RuntimeError(std::string("Invalid port number ") +
|
||||
std::to_string(port) +
|
||||
". Must be between 1024 - 65535.");
|
||||
}
|
||||
}
|
||||
|
||||
void validatePortRange(uint16_t startPort, int numPorts) {
|
||||
validatePortNumber(startPort);
|
||||
if ((startPort + numPorts) > std::numeric_limits<uint16_t>::max()) {
|
||||
throw RuntimeError("Invalid port range. Must be between 1 - 65535.");
|
||||
}
|
||||
validatePortNumber(startPort + numPorts - 1);
|
||||
}
|
||||
|
||||
} // namespace sls
|
||||
|
||||
Reference in New Issue
Block a user