mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 21:07:13 +02:00
ensuring no duplicate rx hostname port combo (#604)
* rx_hostname and port combo to one, or hostname to all, or a vector of hostnames and ports, ignoring none or empty, then verifying no duplicates for the host port combo including from shared memory * extracted function for rx_hostname (#694) * c++14 revert * unique hostname-port combo for port, hostname, rx_tcpport (#696) * verify unique combo for rx_port as well * check unique hostname-port combo also when setting control port, hostname, rx_hostname and rx_tcpport --------- Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com> Co-authored-by: Erik Frojdh <erik.frojdh@psi.ch>
This commit is contained in:
@ -50,4 +50,17 @@ bool replace_first(std::string *s, const std::string &substr,
|
||||
return false;
|
||||
}
|
||||
|
||||
std::pair<std::string, int> ParseHostPort(const std::string &s) {
|
||||
// TODO deal with to many :, port not there?
|
||||
// no port return hostname as is and port as 0
|
||||
std::string host;
|
||||
int port{0};
|
||||
auto res = split(s, ':');
|
||||
host = res[0];
|
||||
if (res.size() > 1) {
|
||||
port = std::stoi(res[1]);
|
||||
}
|
||||
return std::make_pair(host, port);
|
||||
}
|
||||
|
||||
}; // namespace sls
|
Reference in New Issue
Block a user